New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use shutil.rmtree instead of os.removedirs #365
Conversation
This fixes a bug in corner case in the `setup.py` shim/scaffolding generated by PyBuilder. When using `install_file` and friends and installing the project via git+ssh protocol the scaffolding `setup.py` crashes during cleanup, because certain directories are non-empty. In order to further demonstrate the issue, I have created a PyBuilder project at: https://github.com/esc/pybuilder-bug-expose If you now try to install this project, you get: ``` % pip install "git+ssh://git@github.com/esc/pybuilder-bug-expose.git#egg=bug" Collecting bug from git+ssh://git@github.com/esc/pybuilder-bug-expose.git#egg=bug Cloning ssh://git@github.com/esc/pybuilder-bug-expose.git to /tmp/pip-build-BE_AGP/bug Complete output from command python setup.py egg_info: pyb 0.11.8 PyBuilder version 0.11.8 Build started at 2016-06-15 16:46:45 ------------------------------------------------------------ [INFO] Building bug version 1.0.dev0 [INFO] Executing build in /tmp/pip-build-BE_AGP/bug [INFO] Going to execute tasks: clean, install_build_dependencies, package [INFO] Removing target directory /tmp/pip-build-BE_AGP/bug/target [INFO] Installing build dependencies [INFO] Installing dependency 'mockito' [INFO] Building distribution in /tmp/pip-build-BE_AGP/bug/target/dist/bug-1.0.dev0 [INFO] Copying scripts to /tmp/pip-build-BE_AGP/bug/target/dist/bug-1.0.dev0/scripts [INFO] Copying resources matching 'foo/bar' from /tmp/pip-build-BE_AGP/bug to /tmp/pip-build-BE_AGP/bug/target/dist/bug-1.0.dev0 [INFO] Writing MANIFEST.in as /tmp/pip-build-BE_AGP/bug/target/dist/bug-1.0.dev0/MANIFEST.in [INFO] Writing setup.py as /tmp/pip-build-BE_AGP/bug/target/dist/bug-1.0.dev0/setup.py ------------------------------------------------------------ BUILD SUCCESSFUL ------------------------------------------------------------ Build finished at 2016-06-15 16:46:45 Build took 0 seconds (598 ms) Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-BE_AGP/bug/setup.py", line 66, in <module> os.removedirs(target_file_name) File "/home/esc/gw/pybuilder-bug-expose/.venv/lib/python2.7/os.py", line 170, in removedirs rmdir(name) OSError: [Errno 39] Directory not empty: '/tmp/pip-build-BE_AGP/bug/foo' ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-BE_AGP/bug/ ``` This pull-request fixes this issue and ensures that the `setup.py` can actually remove the directories.
I hit this nice little bug today... |
There is another branch,
|
Please remove from mailing lists. On Wed, Jun 15, 2016 at 9:56 AM Valentin Haenel notifications@github.com
|
Whew, nice catch. I'll have a look as soon as I am able (depending on how interesting the scaladays tracks are ;-))
|
@tendryll this is not a mailing list. You must be watching the repository, please log in to GitHub and unwatch it.
|
I'm unsure if the fix is correct, because I don't understand the logic in the scaffolding |
I'll take a look tomorrow. Thanks! |
@esc the logic actually deletes the possible leftover built dists, whether they are directories or simple files. The change is fine. |
This fixes a bug in corner case in the
setup.py
shim/scaffolding generated byPyBuilder. When using
install_file
and friends and installing the project viagit+ssh protocol the scaffolding
setup.py
crashes during cleanup, becausecertain directories are non-empty.
In order to further demonstrate the issue, I have created a PyBuilder project
at:
https://github.com/esc/pybuilder-bug-expose
If you now try to install this project, you get:
This pull-request fixes this issue and ensures that the
setup.py
canactually remove the directories.