Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
61f996b2
Commit
61f996b2
authored
Feb 21, 2012
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12406: prevent case where shortened name could conflict with short name.
parent
dc4170c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Tools/msi/msilib.py
Tools/msi/msilib.py
+10
-8
No files found.
Tools/msi/msilib.py
View file @
61f996b2
...
...
@@ -408,7 +408,7 @@ class Directory:
self
.
physical
=
physical
self
.
logical
=
logical
self
.
component
=
None
self
.
short_names
=
sets
.
Set
()
self
.
short_names
=
{}
self
.
ids
=
sets
.
Set
()
self
.
keyfiles
=
{}
self
.
componentflags
=
componentflags
...
...
@@ -456,23 +456,25 @@ class Directory:
[(
feature
.
id
,
component
)])
def
make_short
(
self
,
file
):
long
=
file
file
=
re
.
sub
(
r'[\
?|><:/*
"+,;=\
[
\]]'
,
'_'
,
file
)
# restrictions on short names
parts
=
file
.
split
(
"."
)
parts
=
file
.
split
(
"."
,
1
)
if
len
(
parts
)
>
1
:
suffix
=
parts
[
-
1
].
upper
()
suffix
=
parts
[
1
].
upper
()
else
:
suffix
=
None
suffix
=
''
prefix
=
parts
[
0
].
upper
()
if
len
(
prefix
)
<=
8
and
(
not
suffix
or
len
(
suffix
)
<=
3
)
:
if
len
(
prefix
)
<=
8
and
'.'
not
in
suffix
and
len
(
suffix
)
<=
3
:
if
suffix
:
file
=
prefix
+
"."
+
suffix
else
:
file
=
prefix
assert
file
not
in
self
.
short_names
assert
file
not
in
self
.
short_names
,
(
file
,
self
.
short_names
[
file
])
else
:
prefix
=
prefix
[:
6
]
if
suffix
:
suffix
=
suffix
[:
3
]
# last three characters of last suffix
suffix
=
suffix
.
rsplit
(
'.'
)[
-
1
][:
3
]
pos
=
1
while
1
:
if
suffix
:
...
...
@@ -484,7 +486,7 @@ class Directory:
assert
pos
<
10000
if
pos
in
(
10
,
100
,
1000
):
prefix
=
prefix
[:
-
1
]
self
.
short_names
.
add
(
file
)
self
.
short_names
[
file
]
=
long
return
file
def
add_file
(
self
,
file
,
src
=
None
,
version
=
None
,
language
=
None
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment