mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Merge pull request #11199 from shanemcd/auto-version
Remove VERSION files, obtain version from git tags.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -58,6 +58,7 @@ __pycache__
|
|||||||
/dist
|
/dist
|
||||||
/*.egg-info
|
/*.egg-info
|
||||||
*.py[c,o]
|
*.py[c,o]
|
||||||
|
/.eggs
|
||||||
|
|
||||||
# JavaScript
|
# JavaScript
|
||||||
/Gruntfile.js
|
/Gruntfile.js
|
||||||
|
|||||||
3
Makefile
3
Makefile
@@ -6,7 +6,7 @@ NPM_BIN ?= npm
|
|||||||
CHROMIUM_BIN=/tmp/chrome-linux/chrome
|
CHROMIUM_BIN=/tmp/chrome-linux/chrome
|
||||||
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
MANAGEMENT_COMMAND ?= awx-manage
|
MANAGEMENT_COMMAND ?= awx-manage
|
||||||
VERSION := $(shell cat VERSION)
|
VERSION := $(shell $(PYTHON) setup.py --version)
|
||||||
|
|
||||||
# NOTE: This defaults the container image version to the branch that's active
|
# NOTE: This defaults the container image version to the branch that's active
|
||||||
COMPOSE_TAG ?= $(GIT_BRANCH)
|
COMPOSE_TAG ?= $(GIT_BRANCH)
|
||||||
@@ -290,7 +290,6 @@ test:
|
|||||||
. $(VENV_BASE)/awx/bin/activate; \
|
. $(VENV_BASE)/awx/bin/activate; \
|
||||||
fi; \
|
fi; \
|
||||||
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider -n auto $(TEST_DIRS)
|
PYTHONDONTWRITEBYTECODE=1 py.test -p no:cacheprovider -n auto $(TEST_DIRS)
|
||||||
cmp VERSION awxkit/VERSION || "VERSION and awxkit/VERSION *must* match"
|
|
||||||
cd awxkit && $(VENV_BASE)/awx/bin/tox -re py3
|
cd awxkit && $(VENV_BASE)/awx/bin/tox -re py3
|
||||||
awx-manage check_migrations --dry-run --check -n 'missing_migration_file'
|
awx-manage check_migrations --dry-run --check -n 'missing_migration_file'
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
19.4.0
|
|
||||||
@@ -4,11 +4,35 @@ import shutil
|
|||||||
from setuptools import setup, find_packages, Command
|
from setuptools import setup, find_packages, Command
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def use_scm_version():
|
||||||
|
return False if version_file() else True
|
||||||
|
|
||||||
|
|
||||||
|
def get_version_from_file():
|
||||||
|
vf = version_file()
|
||||||
|
if vf:
|
||||||
|
with open(vf, 'r') as file:
|
||||||
|
return file.read().strip()
|
||||||
|
|
||||||
|
|
||||||
|
def version_file():
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
version_file = os.path.join(current_dir, 'VERSION')
|
version_file = os.path.join(current_dir, 'VERSION')
|
||||||
with open(version_file, 'r') as file:
|
|
||||||
return file.read().strip()
|
if os.path.exists(version_file):
|
||||||
|
return version_file
|
||||||
|
|
||||||
|
|
||||||
|
def setup_requires():
|
||||||
|
if version_file():
|
||||||
|
return []
|
||||||
|
else:
|
||||||
|
return ['setuptools_scm']
|
||||||
|
|
||||||
|
|
||||||
|
extra_setup_args = {}
|
||||||
|
if not version_file():
|
||||||
|
extra_setup_args.update(dict(use_scm_version=dict(root="..", relative_to=__file__), setup_requires=setup_requires()))
|
||||||
|
|
||||||
|
|
||||||
class CleanCommand(Command):
|
class CleanCommand(Command):
|
||||||
@@ -53,7 +77,7 @@ class CleanCommand(Command):
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='awxkit',
|
name='awxkit',
|
||||||
version=get_version(),
|
version=get_version_from_file(),
|
||||||
description='The official command line interface for Ansible AWX',
|
description='The official command line interface for Ansible AWX',
|
||||||
author='Red Hat, Inc.',
|
author='Red Hat, Inc.',
|
||||||
author_email='info@ansible.com',
|
author_email='info@ansible.com',
|
||||||
@@ -84,4 +108,5 @@ setup(
|
|||||||
'Topic :: System :: Systems Administration',
|
'Topic :: System :: Systems Administration',
|
||||||
],
|
],
|
||||||
entry_points={'console_scripts': ['akit=awxkit.scripts.basic_session:load_interactive', 'awx=awxkit.cli:run']},
|
entry_points={'console_scripts': ['akit=awxkit.scripts.basic_session:load_interactive', 'awx=awxkit.cli:run']},
|
||||||
|
**extra_setup_args,
|
||||||
)
|
)
|
||||||
|
|||||||
33
setup.py
33
setup.py
@@ -18,12 +18,35 @@ sharedir = "/usr/share/awx"
|
|||||||
docdir = "/usr/share/doc/awx"
|
docdir = "/usr/share/doc/awx"
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def use_scm_version():
|
||||||
|
return False if version_file() else True
|
||||||
|
|
||||||
|
|
||||||
|
def get_version_from_file():
|
||||||
|
vf = version_file()
|
||||||
|
if vf:
|
||||||
|
with open(vf, 'r') as file:
|
||||||
|
return file.read().strip()
|
||||||
|
|
||||||
|
|
||||||
|
def version_file():
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
version_file = os.path.join(current_dir, 'VERSION')
|
version_file = os.path.join(current_dir, 'VERSION')
|
||||||
with open(version_file, 'r') as file:
|
|
||||||
return file.read().strip()
|
|
||||||
|
|
||||||
|
if os.path.exists(version_file):
|
||||||
|
return version_file
|
||||||
|
|
||||||
|
|
||||||
|
def setup_requires():
|
||||||
|
if version_file():
|
||||||
|
return []
|
||||||
|
else:
|
||||||
|
return ['setuptools_scm']
|
||||||
|
|
||||||
|
|
||||||
|
extra_setup_args = {}
|
||||||
|
if not version_file():
|
||||||
|
extra_setup_args.update(dict(use_scm_version=use_scm_version(), setup_requires=setup_requires()))
|
||||||
|
|
||||||
if os.path.exists("/etc/debian_version"):
|
if os.path.exists("/etc/debian_version"):
|
||||||
sysinit = "/etc/init.d"
|
sysinit = "/etc/init.d"
|
||||||
@@ -93,7 +116,7 @@ class egg_info_dev(_egg_info):
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name=os.getenv('NAME', 'awx'),
|
name=os.getenv('NAME', 'awx'),
|
||||||
version=get_version(),
|
version=get_version_from_file(),
|
||||||
author='Ansible, Inc.',
|
author='Ansible, Inc.',
|
||||||
author_email='info@ansible.com',
|
author_email='info@ansible.com',
|
||||||
description='awx: API, UI and Task Engine for Ansible',
|
description='awx: API, UI and Task Engine for Ansible',
|
||||||
@@ -104,7 +127,6 @@ setup(
|
|||||||
packages=['awx'],
|
packages=['awx'],
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
setup_requires=[],
|
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
'Development Status :: 5 - Production/Stable',
|
||||||
'Environment :: Web Environment',
|
'Environment :: Web Environment',
|
||||||
@@ -165,4 +187,5 @@ setup(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
cmdclass={'egg_info_dev': egg_info_dev},
|
cmdclass={'egg_info_dev': egg_info_dev},
|
||||||
|
**extra_setup_args,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user