#319 Filter koji and rpm-py-installer from install_requires when building rpm
Closed 6 years ago by churchyard. Opened 6 years ago by churchyard.
churchyard/rpkg filer-requires  into  master

file modified
+7
@@ -46,6 +46,13 @@ 

          'unittest2'

      ]

  

+ if 'RPM_BUILD_ROOT' in os.environ:

+     # we are in rpm package and we cannot list koji and rpm-py-installer

+     # because of https://bugzilla.redhat.com/show_bug.cgi?id=1579367

+     install_requires = [r for r in install_requires

+                         if not r.startswith('koji')

+                         and not r.startswith('rpm-py-installer')]

+ 

  readme_rst = os.path.join(setup_py_path, 'README.rst')

  with open(readme_rst, 'r') as readme:

      long_description = readme.read().rstrip()

@churchyard Thanks for making this patch. how about use this logic (I also mentioned in that bug)

try:
    import rpm
except ImportError:
    rpm = None
if rpm is None:
    # For the case of running in a clean Python virtualenv.
    # Next time, rpm will be available.
    install_requires.append('rpm-py-installer')
else:
    # Whatever in a Python virtualenv with rpm-py-installer installed,
    # or python3-rpm is installed in the system
    install_requires.append('rpm')

One of the points to use this logic is to not mention RPM_BUILD_ROOT in rpkg source code in order to decouple with the build system.

For the koji, I think we can patch the SPEC to remove it from requirements/pypi.txt as a workaround before Koji team fixes https://pagure.io/koji/issue/912

What do you think?

install_requires.append('rpm') will put rpm in /usr/lib/python3.6/site-packages/rpkg-1.54-py3.6.egg-info/requires.txt and that is available apparently via /usr/lib64/python3.6/site-packages/rpm-4.14.1-py3.6.egg-info.

So this should work, ok.

@churchyard Are you going to update this patch? BTW, @jaruga suggests a better version in https://bugzilla.redhat.com/show_bug.cgi?id=1579367#c10

I thought we close this and you commit your version (or @jaruga's).

Pull-Request has been closed by churchyard

6 years ago
Metadata