Skip to content

Commit

Permalink
Use PBR for receptorctl
Browse files Browse the repository at this point in the history
Removes the need for creating / reading the .VERSION file
  • Loading branch information
shanemcd committed Mar 31, 2021
1 parent cfefc1a commit b5aa832
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ rpmbuild/
.rpm-builder-flag
.VERSION
kubectl
/receptorctl/AUTHORS
/receptorctl/ChangeLog
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ rpms: $(RPMS)

RECEPTORCTL_WHEEL = receptorctl/dist/receptorctl-$(VERSION)-py3-none-any.whl
$(RECEPTORCTL_WHEEL): receptorctl/README.md receptorctl/setup.py $(shell find receptorctl/receptorctl -type f -name '*.py')
@echo $(VERSION) > .VERSION
@cd receptorctl && python3 setup.py bdist_wheel

receptorctl_wheel: $(RECEPTORCTL_WHEEL)
Expand All @@ -151,7 +150,6 @@ receptorctl_sdist: $(RECEPTORCTL_SDIST)

RECEPTOR_PYTHON_WORKER_WHEEL = receptor-python-worker/dist/receptor_python_worker-$(VERSION)-py3-none-any.whl
$(RECEPTOR_PYTHON_WORKER_WHEEL): receptor-python-worker/README.md receptor-python-worker/setup.py $(shell find receptor-python-worker/receptor_python_worker -type f -name '*.py')
@echo $(VERSION) > .VERSION
@cd receptor-python-worker && python3 setup.py bdist_wheel

container: .container-flag-$(VERSION)
Expand Down
1 change: 1 addition & 0 deletions receptorctl/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include requirements.txt # Needs manual inclusion due to PBR bug
3 changes: 3 additions & 0 deletions receptorctl/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python-dateutil
click
pyyaml
16 changes: 16 additions & 0 deletions receptorctl/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[metadata]
name = receptorctl
author = Red Hat
author-email = info@ansible.com
summary = "Receptorctl is a front-end CLI and importable Python library that interacts with Receptor over its control socket interface."
home-page = https://github.com/project-receptor/receptor/tree/devel/receptorctl
description-file = README.md
description-content-type = text/markdown

[entry_points]
console_scripts =
receptorctl = receptorctl:run

[files]
packages =
receptorctl
48 changes: 3 additions & 45 deletions receptorctl/setup.py
Original file line number Diff line number Diff line change
@@ -1,50 +1,8 @@
#!/usr/bin/env python

import os
import subprocess
from setuptools import setup, find_packages

with open('README.md', 'r') as f:
long_description = f.read()

verfile = None
for fn in ['.VERSION', '../.VERSION']:
if os.path.exists(fn):
verfile = fn
break

if verfile is None:
subprocess.run(["make", "version"], cwd="../")
verfile = '../.VERSION'

if not os.path.exists(verfile):
raise IOError("Version file not found.")

with open(verfile, 'r') as f:
version = f.readline().rstrip('\n\r')
from setuptools import setup

setup(
name="receptorctl",
version=version,
author='Red Hat',
url="https://github.com/project-receptor/receptor/receptorctl",
license='APL 2.0',
packages=find_packages(),
long_description=long_description,
long_description_content_type='text/markdown',
install_requires=[
"setuptools",
"python-dateutil",
"click",
"pyyaml"
],
zip_safe=False,
entry_points={
'console_scripts': [
'receptorctl=receptorctl:run'
]
},
classifiers=[
"Programming Language :: Python :: 3",
],
setup_requires=['pbr'],
pbr=True,
)

0 comments on commit b5aa832

Please sign in to comment.