diff options
author | Miro Hrončok <miro@hroncok.cz> | 2018-07-20 16:48:06 +0200 |
---|---|---|
committer | Miro Hrončok <miro@hroncok.cz> | 2018-07-20 17:00:16 +0200 |
commit | b90515f8041352a33c6ca7099be38dee0d5a5cdd (patch) | |
tree | b5a486d0a3a74490a3d1db896e667ac64822a7bd /setuptools/command | |
parent | b48d4900233169c1143adfdd64aa00230ae13f26 (diff) | |
download | external_python_setuptools-b90515f8041352a33c6ca7099be38dee0d5a5cdd.tar.gz external_python_setuptools-b90515f8041352a33c6ca7099be38dee0d5a5cdd.tar.bz2 external_python_setuptools-b90515f8041352a33c6ca7099be38dee0d5a5cdd.zip |
Make install directory if it doesn't exist yet
Problem: In Fedora, `sudo python3 setup.py install` installs to
/usr/local/lib/pythonX.Y/site-packages. However that directory is
not always there as it is not installed together with the python3
package (Fedora packages should not install stuff to /usr/local).
When the directory does not exist an installation attempt fails with:
[Errno 2] No such file or directory:
'/usr/local/lib/python3.7/site-packages/test-easy-install-11875.write-test'
Solution: Make the directory if it doesn't exists yet. If user has
no permissions, the above error is preserved, yet with root (sudo)
it works now.
Diffstat (limited to 'setuptools/command')
-rwxr-xr-x | setuptools/command/easy_install.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 05508ceb..5b65b95d 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -450,6 +450,12 @@ class easy_install(Command): instdir = normalize_path(self.install_dir) pth_file = os.path.join(instdir, 'easy-install.pth') + if not os.path.exists(instdir): + try: + os.makedirs(instdir) + except (OSError, IOError): + self.cant_write_to_target() + # Is it a configured, PYTHONPATH, implicit, or explicit site dir? is_site_dir = instdir in self.all_site_dirs |