From dbcd0a111b38cc856b81da957eda4f32a4621dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Thu, 19 Jul 2018 11:31:18 +0200 Subject: [PATCH] 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 --- create-site-packages.patch | 17 +++++++++++++++++ python-setuptools.spec | 13 +++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 create-site-packages.patch diff --git a/create-site-packages.patch b/create-site-packages.patch new file mode 100644 index 0000000..60f9795 --- /dev/null +++ b/create-site-packages.patch @@ -0,0 +1,17 @@ +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 + diff --git a/python-setuptools.spec b/python-setuptools.spec index eb4ee5f..98562c9 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -31,7 +31,7 @@ Name: python-setuptools Version: 39.2.0 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Easily build and distribute Python packages Group: Applications/System @@ -39,6 +39,12 @@ License: MIT URL: https://pypi.python.org/pypi/%{srcname} Source0: https://files.pythonhosted.org/packages/source/s/%{srcname}/%{srcname}-%{version}.zip +# 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 +# https://bugzilla.redhat.com/show_bug.cgi?id=1576924 +Patch0: create-site-packages.patch + BuildArch: noarch BuildRequires: gcc @@ -123,7 +129,7 @@ execute the software that requires pkg_resources.py. %prep -%setup -q -n %{srcname}-%{version} +%autosetup -p1 -n %{srcname}-%{version} # We can't remove .egg-info (but it doesn't matter, since it'll be rebuilt): # The problem is that to properly execute setuptools' setup.py, @@ -246,6 +252,9 @@ PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore= %changelog +* Thu Jul 19 2018 Miro HronĨok - 39.2.0-6 +- Create /usr/local/lib/pythonX.Y when needed (#1576924) + * Sat Jul 14 2018 Fedora Release Engineering - 39.2.0-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild