python-setuptools/create-site-packages.patch
Miro Hrončok dbcd0a111b Create /usr/local/lib/pythonX.Y when needed (#1576924)
In Fedora, sudo setup.py install installs to /usr/local/lib/pythonX.Y/site-packages
But pythonX doesn't own that dir, that would be against FHS
We need to create it if it doesn't exist

Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1576924
2018-07-19 12:46:43 +02:00

18 lines
677 B
Diff

diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 91c48b3..0c9b0f4 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -446,6 +446,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