Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/msilib/__init__.py

    r2 r391  
    174174
    175175def make_id(str):
    176     #str = str.replace(".", "_") # colons are allowed
    177     str = str.replace(" ", "_")
    178     str = str.replace("-", "_")
    179     if str[0] in string.digits:
    180         str = "_"+str
     176    identifier_chars = string.ascii_letters + string.digits + "._"
     177    str = "".join([c if c in identifier_chars else "_" for c in str])
     178    if str[0] in (string.digits + "."):
     179        str = "_" + str
    181180    assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str
    182181    return str
     
    286285
    287286    def make_short(self, file):
     287        oldfile = file
     288        file = file.replace('+', '_')
     289        file = ''.join(c for c in file if not c in ' "/\[]:;=,')
    288290        parts = file.split(".")
    289         if len(parts)>1:
     291        if len(parts) > 1:
     292            prefix = "".join(parts[:-1]).upper()
    290293            suffix = parts[-1].upper()
    291         else:
     294            if not prefix:
     295                prefix = suffix
     296                suffix = None
     297        else:
     298            prefix = file.upper()
    292299            suffix = None
    293         prefix = parts[0].upper()
    294         if len(prefix) <= 8 and (not suffix or len(suffix)<=3):
     300        if len(parts) < 3 and len(prefix) <= 8 and file == oldfile and (
     301                                                not suffix or len(suffix) <= 3):
    295302            if suffix:
    296303                file = prefix+"."+suffix
    297304            else:
    298305                file = prefix
    299             assert file not in self.short_names
    300         else:
     306        else:
     307            file = None
     308        if file is None or file in self.short_names:
    301309            prefix = prefix[:6]
    302310            if suffix:
     
    319327    def add_file(self, file, src=None, version=None, language=None):
    320328        """Add a file to the current component of the directory, starting a new one
    321         one if there is no current component. By default, the file name in the source
     329        if there is no current component. By default, the file name in the source
    322330        and the file table will be identical. If the src file is specified, it is
    323331        interpreted relative to the current directory. Optionally, a version and a
     
    331339        absolute = os.path.join(self.absolute, src)
    332340        assert not re.search(r'[\?|><:/*]"', file) # restrictions on long names
    333         if self.keyfiles.has_key(file):
     341        if file in self.keyfiles:
    334342            logical = self.keyfiles[file]
    335343        else:
  • python/trunk/Lib/msilib/schema.py

    r2 r391  
    959959(u'Shortcut',u'Name',u'N',None, None, None, None, u'Filename',None, u'The name of the shortcut to be created.',),
    960960(u'Shortcut',u'Description',u'Y',None, None, None, None, u'Text',None, u'The description for the shortcut.',),
    961 (u'Shortcut',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table denoting the component whose selection gates the the shortcut creation/deletion.',),
     961(u'Shortcut',u'Component_',u'N',None, None, u'Component',1,u'Identifier',None, u'Foreign key into the Component table denoting the component whose selection gates the shortcut creation/deletion.',),
    962962(u'Shortcut',u'Icon_',u'Y',None, None, u'Icon',1,u'Identifier',None, u'Foreign key into the File table denoting the external icon file for the shortcut.',),
    963963(u'Shortcut',u'IconIndex',u'Y',-32767,32767,None, None, None, None, u'The icon index for the shortcut.',),
Note: See TracChangeset for help on using the changeset viewer.