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

Fix for auto_chmod behavior #988

Merged
merged 1 commit into from Mar 3, 2017

Conversation

Projects
None yet
2 participants
@estyrke
Contributor

estyrke commented Feb 27, 2017

Apparently, in (at least) python 3.5.2, the function that is called on Windows to remove files is os.unlink and not os.remove. This results in permission errors when trying to clean up after easy_install has been used to install a package from a Git repository.

Fix for auto_chmod behavior
Apparently, in (at least) python 3.5.2, the function that is called on Windows to remove files is os.unlink and not os.remove. This results in permission errors when trying to clean up after easy_install has been used to install a package from a Git repository.
@estyrke

This comment has been minimized.

Contributor

estyrke commented Feb 27, 2017

This is an example of the error (cvtools-1.20rc0.zip is a source distribution that has install_requires=['pyxb'], dependency_links=['git+https://github.com/estyrke/pyxb.git#egg=pyxb-1.2.6-DEV'], in its setup.py).

C:\Users\EmilS\Documents\Code\CvTools>.tox\py35-win64\Scripts\python -m pip -v install .tox\dist\CvTools-1.20rc0.zip
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Processing c:\users\emils\documents\code\cvtools\.tox\dist\cvtools-1.20rc0.zip
 Running setup.py (path:C:\Users\EmilS\AppData\Local\Temp\pip-il942ay9-build\setup.py) egg_info for package from file:///C:/Users/EmilS/Documents/Code/CvTools/.tox/dist/CvTools-1.20rc0.zip
   Running command python setup.py egg_info
   C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\dist.py:333: UserWarning: Normalizing '1.2.6-DEV' to '1.2.6.dev0'
     normalized_version,
   warning: no files found matching 'MANIFEST'
   no previously-included directories found matching 'pyxb\bundles\core\schemas'
   no previously-included directories found matching 'pyxb\bundles\core\remote'
   no previously-included directories found matching 'pyxb\bundles\wssplat\schemas'
   no previously-included directories found matching 'pyxb\bundles\wssplat\remote'
   no previously-included directories found matching 'pyxb\bundles\opengis\schemas'
   no previously-included directories found matching 'pyxb\bundles\opengis\remote'
   no previously-included directories found matching 'doc\_build'
   no previously-included directories found matching 'doc\W3C'
   warning: no previously-included files matching '*~' found anywhere in distribution
   zip_safe flag not set; analyzing archive contents...
   pyxb.namespace.__pycache__.archive.cpython-35: module references __file__
   pyxb.utils.__pycache__.six.cpython-35: module references __path__

   Installed c:\users\emils\appdata\local\temp\pip-il942ay9-build\.eggs\pyxb-1.2.6.dev0-py3.5.egg
   Traceback (most recent call last):
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 381, in _rmtree_unsafe
       os.unlink(fullname)
   PermissionError: [WinError 5] ┼tkomst nekad: 'C:\\Users\\EmilS\\AppData\\Local\\Temp\\easy_install-pj7vbsqv\\pyxb.git\\.git\\objects\\pack\\pack-7320a85cb6c0d30cdfd68b3b269fb97b5bd49e39.idx'

   During handling of the above exception, another exception occurred:

   Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "C:\Users\EmilS\AppData\Local\Temp\pip-il942ay9-build\setup.py", line 126, in <module>
       "build_xsd = __main__:BuildXsdCommand",
     File "C:\Users\EmilS\AppData\Local\Continuum\Miniconda3\Lib\distutils\core.py", line 108, in setup
       _setup_distribution = dist = klass(attrs)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\dist.py", line 317, in __init__
       self.fetch_build_eggs(attrs['setup_requires'])
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\dist.py", line 372, in fetch_build_eggs
       replace_conflicting=True,
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pkg_resources\__init__.py", line 851, in resolve
       dist = best[req.key] = env.best_match(req, ws, installer)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pkg_resources\__init__.py", line 1123, in best_match
       return self.obtain(req, installer)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pkg_resources\__init__.py", line 1135, in obtain
       return installer(requirement)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\dist.py", line 440, in fetch_build_egg
       return cmd.easy_install(req)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\command\easy_install.py", line 674, in easy_install
       return self.install_item(spec, dist.location, tmpdir, deps)
     File "C:\Users\EmilS\AppData\Local\Continuum\Miniconda3\Lib\contextlib.py", line 66, in __exit__
       next(self.gen)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\command\easy_install.py", line 638, in _tmpdir
       os.path.exists(tmpdir) and rmtree(rmtree_safe(tmpdir))
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\command\easy_install.py", line 2233, in rmtree
       return shutil.rmtree(path, ignore_errors, onerror)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 488, in rmtree
       return _rmtree_unsafe(path, onerror)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 378, in _rmtree_unsafe
       _rmtree_unsafe(fullname, onerror)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 378, in _rmtree_unsafe
       _rmtree_unsafe(fullname, onerror)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 378, in _rmtree_unsafe
       _rmtree_unsafe(fullname, onerror)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 378, in _rmtree_unsafe
       _rmtree_unsafe(fullname, onerror)
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\shutil.py", line 383, in _rmtree_unsafe
       onerror(os.unlink, fullname, sys.exc_info())
     File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\setuptools\command\easy_install.py", line 1683, in auto_chmod
       six.reraise(et, (ev[0], ev[1] + (" %s %s" % (func, arg))))
   TypeError: 'PermissionError' object is not subscriptable
   auto_chmod
Cleaning up...
Command "python setup.py egg_info" failed with error code 1 in C:\Users\EmilS\AppData\Local\Temp\pip-il942ay9-build\
Exception information:
Traceback (most recent call last):
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\basecommand.py", line 215, in main
   status = self.run(options, args)
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\commands\install.py", line 335, in run
   wb.build(autobuilding=True)
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\wheel.py", line 749, in build
   self.requirement_set.prepare_files(self.finder)
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
   ignore_dependencies=self.ignore_dependencies))
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\req\req_set.py", line 634, in _prepare_file
   abstract_dist.prep_for_dist()
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\req\req_set.py", line 129, in prep_for_dist
   self.req_to_install.run_egg_info()
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\req\req_install.py", line 439, in run_egg_info
   command_desc='python setup.py egg_info')
 File "C:\Users\EmilS\Documents\Code\CvTools\.tox\py35-win64\lib\site-packages\pip\utils\__init__.py", line 707, in call_subprocess
   % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\EmilS\AppData\Local\Temp\pip-il942ay9-build\
@estyrke

This comment has been minimized.

Contributor

estyrke commented Feb 27, 2017

The corresponding check in pip looks a bit different - that might be another option: https://github.com/pypa/pip/blob/9.0.1/pip/utils/__init__.py#L105

@jaraco jaraco merged commit 093d280 into pypa:master Mar 3, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment