summaryrefslogtreecommitdiffstats
path: root/Lib/msilib/__init__.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2011-03-27 08:14:57 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2011-03-27 08:14:57 (GMT)
commita6e0b4f2ede0613a8780c3e2d8e9387a280afd6c (patch)
treef7c069cc224a7161f400c71ff95e7cbbf8214d52 /Lib/msilib/__init__.py
parent1a07f07337dc722b9d6f347944abca4c8fbf5f02 (diff)
parent9bad3a99dd9a9804abc47ae252176064214b29b4 (diff)
downloadcpython-a6e0b4f2ede0613a8780c3e2d8e9387a280afd6c.zip
cpython-a6e0b4f2ede0613a8780c3e2d8e9387a280afd6c.tar.gz
cpython-a6e0b4f2ede0613a8780c3e2d8e9387a280afd6c.tar.bz2
merge #7639
Diffstat (limited to 'Lib/msilib/__init__.py')
-rw-r--r--Lib/msilib/__init__.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/Lib/msilib/__init__.py b/Lib/msilib/__init__.py
index bd3e1f2..74448e6 100644
--- a/Lib/msilib/__init__.py
+++ b/Lib/msilib/__init__.py
@@ -173,10 +173,10 @@ def add_tables(db, module):
def make_id(str):
#str = str.replace(".", "_") # colons are allowed
- str = str.replace(" ", "_")
- str = str.replace("-", "_")
- if str[0] in string.digits:
- str = "_"+str
+ for c in " -+~;":
+ str = str.replace(c, "_")
+ if str[0] in (string.digits + "."):
+ str = "_" + str
assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str
return str
@@ -284,19 +284,28 @@ class Directory:
[(feature.id, component)])
def make_short(self, file):
+ oldfile = file
+ file = file.replace('+', '_')
+ file = ''.join(c for c in file if not c in ' "/\[]:;=,')
parts = file.split(".")
- if len(parts)>1:
+ if len(parts) > 1:
+ prefix = "".join(parts[:-1]).upper()
suffix = parts[-1].upper()
+ if not prefix:
+ prefix = suffix
+ suffix = None
else:
+ prefix = file.upper()
suffix = None
- prefix = parts[0].upper()
- if len(prefix) <= 8 and (not suffix or len(suffix)<=3):
+ if len(parts) < 3 and len(prefix) <= 8 and file == oldfile and (
+ not suffix or len(suffix) <= 3):
if suffix:
file = prefix+"."+suffix
else:
file = prefix
- assert file not in self.short_names
else:
+ file = None
+ if file is None or file in self.short_names:
prefix = prefix[:6]
if suffix:
suffix = suffix[:3]