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
cef81109
Commit
cef81109
authored
Oct 24, 2009
by
Tarek Ziadé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#7066 - Fixed distutils.archive_util.make_archive behavior so it restores the cwd
parent
8a3f574e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
5 deletions
+22
-5
archive_util.py
archive_util.py
+6
-4
tests/test_archive_util.py
tests/test_archive_util.py
+16
-1
No files found.
archive_util.py
View file @
cef81109
...
...
@@ -233,9 +233,11 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
kwargs
[
'owner'
]
=
owner
kwargs
[
'group'
]
=
group
filename
=
func
(
base_name
,
base_dir
,
**
kwargs
)
if
root_dir
is
not
None
:
log
.
debug
(
"changing back to '%s'"
,
save_cwd
)
os
.
chdir
(
save_cwd
)
try
:
filename
=
func
(
base_name
,
base_dir
,
**
kwargs
)
finally
:
if
root_dir
is
not
None
:
log
.
debug
(
"changing back to '%s'"
,
save_cwd
)
os
.
chdir
(
save_cwd
)
return
filename
tests/test_archive_util.py
View file @
cef81109
...
...
@@ -8,7 +8,8 @@ from os.path import splitdrive
import
warnings
from
distutils.archive_util
import
(
check_archive_formats
,
make_tarball
,
make_zipfile
,
make_archive
)
make_zipfile
,
make_archive
,
ARCHIVE_FORMATS
)
from
distutils.spawn
import
find_executable
,
spawn
from
distutils.tests
import
support
from
test.test_support
import
check_warnings
...
...
@@ -262,6 +263,20 @@ class ArchiveUtilTestCase(support.TempdirManager,
finally
:
archive
.
close
()
def
test_make_archive_cwd
(
self
):
current_dir
=
os
.
getcwd
()
def
_breaks
(
*
args
,
**
kw
):
raise
RuntimeError
()
ARCHIVE_FORMATS
[
'xxx'
]
=
(
_breaks
,
[],
'xxx file'
)
try
:
try
:
make_archive
(
'xxx'
,
'xxx'
,
root_dir
=
self
.
mkdtemp
())
except
:
pass
self
.
assertEquals
(
os
.
getcwd
(),
current_dir
)
finally
:
del
ARCHIVE_FORMATS
[
'xxx'
]
def
test_suite
():
return
unittest
.
makeSuite
(
ArchiveUtilTestCase
)
...
...
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