From 4a8e8d4fbf05f52c760c2956e7633db9827c327a Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Fri, 23 Jun 2017 08:48:39 -0400 Subject: [PATCH] ansible-tower-isolated RPM --- Makefile | 7 ++++--- setup.py | 5 ++++- tools/scripts/tower-expect | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100755 tools/scripts/tower-expect diff --git a/Makefile b/Makefile index 2247066ea2..48333cfaca 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ endif GIT_DATE := $(shell git log -n 1 --format="%ai") DATE := $(shell date -u +%Y%m%d%H%M) -NAME = ansible-tower +NAME ?= ansible-tower VERSION = $(shell $(PYTHON) -c "from awx import __version__; print(__version__.split('-')[0])") GIT_REMOTE_URL = $(shell git config --get remote.origin.url) BUILD = 0.git$(DATE) @@ -73,6 +73,7 @@ else SETUP_TAR_NAME=$(NAME)-setup-$(VERSION)-$(RELEASE) SDIST_TAR_NAME=$(NAME)-$(VERSION)-$(RELEASE) endif +SDIST_COMMAND ?= sdist SDIST_TAR_FILE=$(SDIST_TAR_NAME).tar.gz SETUP_TAR_FILE=$(SETUP_TAR_NAME).tar.gz SETUP_TAR_LINK=$(NAME)-setup-latest.tar.gz @@ -681,7 +682,7 @@ release_clean: -(rm -rf ($RELEASE)) dist/$(SDIST_TAR_FILE): ui-release - BUILD="$(BUILD)" $(PYTHON) setup.py sdist + BUILD="$(BUILD)" $(PYTHON) setup.py $(SDIST_COMMAND) sdist: dist/$(SDIST_TAR_FILE) @echo "#############################################" @@ -729,7 +730,7 @@ rpm-build/$(SDIST_TAR_FILE): rpm-build dist/$(SDIST_TAR_FILE) tar-build/$(SETUP_ cp packaging/rpm/tower.te rpm-build/ cp packaging/rpm/tower.fc rpm-build/ - cp packaging/rpm/$(NAME).sysconfig rpm-build/ + cp packaging/rpm/ansible-tower.sysconfig rpm-build/ cp packaging/remove_tower_source.py rpm-build/ cp packaging/bytecompile.sh rpm-build/ cp tar-build/$(SETUP_TAR_FILE) rpm-build/ diff --git a/setup.py b/setup.py index 3e680588fa..402cc5c01c 100755 --- a/setup.py +++ b/setup.py @@ -46,8 +46,11 @@ else: class sdist_isolated(sdist): includes = [ + 'include Makefile', 'include awx/__init__.py', 'include awx/main/isolated/run.py', + 'include tools/scripts/tower-expect', + 'include requirements/requirements_isolated.txt', 'recursive-include awx/lib *.py', ] @@ -109,7 +112,7 @@ def proc_data_files(data_files): setup( - name='ansible-tower', + name=os.getenv('NAME', 'ansible-tower'), version=__version__.split("-")[0], # FIXME: Should keep full version here? author='Ansible, Inc.', author_email='info@ansible.com', diff --git a/tools/scripts/tower-expect b/tools/scripts/tower-expect new file mode 100755 index 0000000000..b4a04e4161 --- /dev/null +++ b/tools/scripts/tower-expect @@ -0,0 +1,4 @@ +#!/bin/bash +AWX_LIB=`/var/lib/awx/venv/tower/bin/python -c 'import os, awx; print os.path.dirname(awx.__file__)'` +. /var/lib/awx/venv/tower/bin/activate +exec env TOWER_LIB_DIRECTORY=$AWX_LIB/lib $AWX_LIB/main/isolated/run.py "$@"