Skip to content

Commit

Permalink
Conditional creation of install_requires of rpm distribution (#114)
Browse files Browse the repository at this point in the history
This commit adds conditinal creation of install_requires list
in setup.py for rpm distribution.
If rpm-py-installer was added there unconditionally,
rpm of ubipop couldn't be installed on some envs.
Implemented in this way there no need to change
anything in .spec file for rpm builds.
  • Loading branch information
rbikar committed Jun 24, 2019
1 parent 2e42716 commit c8731e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
requests
more-executors
ubi-config
rpm-py-installer
ubi-config
18 changes: 17 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from setuptools import setup
import pkg_resources


def get_description():
Expand All @@ -14,9 +15,24 @@ def get_long_description():
return text[idx:]


def get_rpm_distribution():
for distribution in ['rpm', 'rpm-python']:
try:
pkg_resources.get_distribution(distribution)
except pkg_resources.DistributionNotFound:
continue
else:
return distribution
return 'rpm-py-installer'


def get_requirements():
requirements = [get_rpm_distribution()]

with open('requirements.txt') as f:
return f.read().splitlines()
requirements.extend(f.read().splitlines())

return requirements


setup(name='ubi-population-tool',
Expand Down

0 comments on commit c8731e1

Please sign in to comment.