mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
Support file names which include '+' (for Tk 8.5).
This commit is contained in:
parent
329d738380
commit
7b9e124776
1 changed files with 2 additions and 1 deletions
|
@ -333,6 +333,7 @@ def make_id(str):
|
||||||
#str = str.replace(".", "_") # colons are allowed
|
#str = str.replace(".", "_") # colons are allowed
|
||||||
str = str.replace(" ", "_")
|
str = str.replace(" ", "_")
|
||||||
str = str.replace("-", "_")
|
str = str.replace("-", "_")
|
||||||
|
str = str.replace("+", "_")
|
||||||
if str[0] in string.digits:
|
if str[0] in string.digits:
|
||||||
str = "_"+str
|
str = "_"+str
|
||||||
assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str
|
assert re.match("^[A-Za-z_][A-Za-z0-9_.]*$", str), "FILE"+str
|
||||||
|
@ -477,6 +478,7 @@ class Directory:
|
||||||
[(feature.id, component)])
|
[(feature.id, component)])
|
||||||
|
|
||||||
def make_short(self, file):
|
def make_short(self, file):
|
||||||
|
file = re.sub(r'[\?|><:/*"+,;=\[\]]', '_', file) # restrictions on short names
|
||||||
parts = file.split(".")
|
parts = file.split(".")
|
||||||
if len(parts)>1:
|
if len(parts)>1:
|
||||||
suffix = parts[-1].upper()
|
suffix = parts[-1].upper()
|
||||||
|
@ -505,7 +507,6 @@ class Directory:
|
||||||
if pos in (10, 100, 1000):
|
if pos in (10, 100, 1000):
|
||||||
prefix = prefix[:-1]
|
prefix = prefix[:-1]
|
||||||
self.short_names.add(file)
|
self.short_names.add(file)
|
||||||
assert not re.search(r'[\?|><:/*"+,;=\[\]]', file) # restrictions on short names
|
|
||||||
return file
|
return file
|
||||||
|
|
||||||
def add_file(self, file, src=None, version=None, language=None):
|
def add_file(self, file, src=None, version=None, language=None):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue