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
7e77495f
Commit
7e77495f
authored
Nov 26, 2002
by
Andrew M. Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Part of the fix for bug #410541: add ensure_relative() function
parent
fc4c1ada
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
dir_util.py
dir_util.py
+15
-1
No files found.
dir_util.py
View file @
7e77495f
...
...
@@ -6,7 +6,7 @@ Utility functions for manipulating directories and directory trees."""
__revision__
=
"$Id$"
import
os
import
os
,
sys
from
types
import
*
from
distutils.errors
import
DistutilsFileError
,
DistutilsInternalError
from
distutils
import
log
...
...
@@ -212,3 +212,17 @@ def remove_tree (directory, verbose=0, dry_run=0):
except
(
IOError
,
OSError
),
exc
:
log
.
warn
(
grok_environment_error
(
exc
,
"error removing %s: "
%
directory
))
def
ensure_relative
(
path
):
"""Take the full path 'path', and make it a relative path so
it can be the second argument to os.path.join().
"""
drive
,
path
=
os
.
path
.
splitdrive
(
path
)
if
sys
.
platform
==
'mac'
:
return
os
.
sep
+
path
else
:
if
path
[
0
:
1
]
==
os
.
sep
:
path
=
drive
+
path
[
1
:]
return
path
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