Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
794b1fe1
Commit
794b1fe1
authored
May 31, 2000
by
Greg Ward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed 'change_root() to work at all on Windows, and to work correctly on Unix.
parent
56c6ea7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
util.py
util.py
+10
-10
No files found.
util.py
View file @
794b1fe1
...
...
@@ -86,22 +86,22 @@ def native_path (pathname):
def
change_root
(
new_root
,
pathname
):
"""Return 'pathname' with 'new_root' prepended. If 'pathname' is
relative, this is equivalent to "os.path.join(new_root,pathname)".
Otherwise, it requires making 'pathname' relative and then joining the
two, which is tricky on DOS/Windows and Mac OS.
"""
if
not
abspath
(
pathname
)
:
return
os
.
path
.
join
(
new_root
,
pathname
)
elif
os
.
name
==
'posix'
:
return
os
.
path
.
join
(
new_root
,
pathname
[
1
:])
two, which is tricky on DOS/Windows and Mac OS.
"""
if
os
.
name
==
'posix'
:
if
not
os
.
path
.
isabs
(
pathname
):
return
os
.
path
.
join
(
new_root
,
pathname
)
else
:
return
os
.
path
.
join
(
new_root
,
pathname
[
1
:])
elif
os
.
name
==
'nt'
:
(
root_drive
,
root_path
)
=
os
.
path
.
splitdrive
(
new_root
)
(
drive
,
path
)
=
os
.
path
.
splitdrive
(
pathname
)
raise
RuntimeError
,
"I give up -- not sure how to do this on Windows"
if
path
[
0
]
==
'
\
\
'
:
path
=
path
[
1
:]
return
os
.
path
.
join
(
new_root
,
path
)
elif
os
.
name
==
'mac'
:
raise
RuntimeError
,
"no clue how to do this on Mac OS"
...
...
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