msg335388 - (view) |
Author: maokk (highwind) |
Date: 2019-02-13 07:15 |
shutil.make_archive("foo...bar..", "zip", os.path.abspath("c:/test")) create zipfile called "foo...bar.zip" not "foo...bar...zip" |
|
|
msg335396 - (view) |
Author: Stéphane Wirtel (matrixise) *  |
Date: 2019-02-13 09:47 |
I have just tried with 3.7.2 and I don't get your error. Python 3.7.2 (default, Jan 16 2019, 19:49:22) [GCC 8.2.1 20181215 (Red Hat 8.2.1-6)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import shutil >>> import os >>> shutil.make_archive('demo...bar..', 'zip', os.path.abspath('/tmp/demo')) '/tmp/demo/demo...bar...zip' >>> ls -l /tmp/demo -rw-r--r--. 1 stephane stephane 226 13 fév 10:45 demo...bar...zip |
|
|
msg335397 - (view) |
Author: Karthikeyan Singaravelan (xtreak) *  |
Date: 2019-02-13 09:49 |
Is this Windows specific? I am unable to reproduce this on Mac and Ubuntu with master and Python 3.7 . ➜ cpython git:(master) ./python.exe -c 'import os, shutil; shutil.make_archive("foo...bar..", "zip", os.path.abspath("./Tools"))' ➜ cpython git:(master) ✗ ls foo...bar...zip foo...bar...zip ➜ cpython git:(master) ✗ rm foo...bar...zip ➜ cpython git:(master) python3.7 -c 'import os, shutil; shutil.make_archive("foo...bar..", "zip", os.path.abspath("./Tools"))' ➜ cpython git:(master) ✗ ls foo...bar...zip foo...bar...zip |
|
|
msg335422 - (view) |
Author: Karthikeyan Singaravelan (xtreak) *  |
Date: 2019-02-13 11:51 |
Could be the case that it's windows specific. For "foo...bar..." abspath returns "foo...bar..." in Python on Mac. I don't have access to Windows but checking this on dotnet fiddle with C# which I hope uses Windows full path strips out the leading dots which I think could be a case with os.path.abspath used in make_archive. Sample fiddle : https://dotnetfiddle.net/PhRr98. |
|
|
msg335446 - (view) |
Author: Karthikeyan Singaravelan (xtreak) *  |
Date: 2019-02-13 14:26 |
On windows os.path.abspath("foo...bar..") returns "foo...bar" which is used in shutil.make_archive [0] returning foo...bar.zip. @matrixise , I am reopening this and adding Windows so that this can be confirmed as known behavior and closed. https://github.com/python/cpython/blob/dcb68f47f74b0cc8a1896d4a4c5a6b83c0bbeeae/Lib/shutil.py#L964 |
|
|
msg351860 - (view) |
Author: Steve Dower (steve.dower) *  |
Date: 2019-09-11 13:17 |
We can fix this - trailing dots before an extension are supported. Probably the best fix is to defer the "abspath" call until after the extension has been added (or apply "abspath" to the directory and then put the base name back on). |
|
|
msg357700 - (view) |
Author: Bruno P. Kinoshita (kinow) * |
Date: 2019-12-02 03:18 |
Tested locally on Win10 pro, and both suggestions of steve.dower worked. I've put a PR (https://github.com/python/cpython/pull/17435) based on his second suggestion. The rationale being that that way, the format function (zip/bztar/etc) will get the absolute file name. I thought this was less risk then trusting that the format function would work with the relative paths in win/linux/etc. |
|
|
msg386257 - (view) |
Author: Steve Dower (steve.dower) *  |
Date: 2021-02-03 18:07 |
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils. If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools |
|
|