mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 05:29:26 -02:30
Added modified sdist command to distribute certain files as pyc only.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
recursive-include awx *.py *.pyc
|
recursive-include awx *.py
|
||||||
recursive-include awx/static *.ico
|
recursive-include awx/static *.ico
|
||||||
recursive-include awx/templates *.html
|
recursive-include awx/templates *.html
|
||||||
recursive-include awx/ui *.html *.js
|
recursive-include awx/ui *.html *.js
|
||||||
@@ -8,10 +8,8 @@ recursive-include awx/lib/site-packages *
|
|||||||
recursive-include config *
|
recursive-include config *
|
||||||
recursive-include config/deb *
|
recursive-include config/deb *
|
||||||
recursive-include config/rpm *
|
recursive-include config/rpm *
|
||||||
recursive-exclude awx devonly.py
|
recursive-exclude awx devonly.py*
|
||||||
recursive-exclude awx/settings local_settings.py*
|
recursive-exclude awx/settings local_settings.py*
|
||||||
include *.py *.pyc *.txt *.md
|
|
||||||
include MANIFEST.in
|
|
||||||
include COPYING
|
include COPYING
|
||||||
prune awx/public
|
prune awx/public
|
||||||
prune awx/projects
|
prune awx/projects
|
||||||
|
|||||||
9
Makefile
9
Makefile
@@ -3,7 +3,7 @@ SITELIB=$(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; pr
|
|||||||
|
|
||||||
# Get the branch information from git
|
# Get the branch information from git
|
||||||
GIT_DATE := $(shell git log -n 1 --format="%ai")
|
GIT_DATE := $(shell git log -n 1 --format="%ai")
|
||||||
DATE := $(shell date --utc +%Y%m%d%H%M)
|
DATE := $(shell date -u +%Y%m%d%H%M)
|
||||||
|
|
||||||
VERSION=$(shell $(PYTHON) -c "from awx import __version__; print(__version__.split('-')[0])")
|
VERSION=$(shell $(PYTHON) -c "from awx import __version__; print(__version__.split('-')[0])")
|
||||||
RELEASE=$(shell $(PYTHON) -c "from awx import __version__; print(__version__.split('-')[1])")
|
RELEASE=$(shell $(PYTHON) -c "from awx import __version__; print(__version__.split('-')[1])")
|
||||||
@@ -131,14 +131,11 @@ sdist: clean
|
|||||||
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
||||||
$(PYTHON) setup.py release_build; \
|
$(PYTHON) setup.py release_build; \
|
||||||
else \
|
else \
|
||||||
BUILD=$(BUILD) $(PYTHON) setup.py sdist; \
|
BUILD=$(BUILD) $(PYTHON) setup.py sdist_awx; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
compiled: sdist
|
compiled: sdist
|
||||||
(cd dist/ && tar zxf $(SDIST_TAR_FILE))
|
#(cd dist/ && tar zxf $(SDIST_TAR_FILE))
|
||||||
(cd dist/ && $(PYTHON) -m compileall -f -x "(plugins/callback/job_event_callback.py|scripts/inventory.py|settings/*.py|site-packages/*.py)" ./awx-$(VERSION)$(BUILD)/awx)
|
|
||||||
(cd dist/ && find ./awx-$(VERSION)$(BUILD)/awx \( -name "*.py" ! -path "*/plugins/callback/job_event_callback.py" ! -path "*/scripts/inventory.py" ! -path "*/settings/*.py" ! -path "*/site-packages/*.py" \) -delete)
|
|
||||||
(cd dist/ && tar zcf $(SDIST_TAR_FILE) awx-$(VERSION)$(BUILD))
|
|
||||||
|
|
||||||
rpm: compiled
|
rpm: compiled
|
||||||
@mkdir -p rpm-build
|
@mkdir -p rpm-build
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ ALLOWED_HOSTS = []
|
|||||||
# CLH 6/20/13 - leave the following set to False until we actually have minified js ready
|
# CLH 6/20/13 - leave the following set to False until we actually have minified js ready
|
||||||
USE_MINIFIED_JS = False
|
USE_MINIFIED_JS = False
|
||||||
|
|
||||||
|
# URL used by inventory script and callback plugin to access API.
|
||||||
INTERNAL_API_URL = 'http://127.0.0.1:80'
|
INTERNAL_API_URL = 'http://127.0.0.1:80'
|
||||||
|
|
||||||
# Load remaining settings from the global settings file specified in the
|
# Load remaining settings from the global settings file specified in the
|
||||||
@@ -35,5 +36,8 @@ try:
|
|||||||
execfile(settings_file)
|
execfile(settings_file)
|
||||||
except IOError:
|
except IOError:
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
raise ImproperlyConfigured('No AWX configuration found in %s'\
|
msg = 'No AWX configuration found at %s.' % settings_file
|
||||||
% settings_file)
|
if 'AWX_SETTINGS_FILE' not in os.environ:
|
||||||
|
msg += '\nDefine the AWX_SETTINGS_FILE environment variable to specify'
|
||||||
|
msg += ' an alternate path.'
|
||||||
|
raise ImproperlyConfigured(msg)
|
||||||
|
|||||||
54
setup.py
54
setup.py
@@ -4,7 +4,10 @@
|
|||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
||||||
import os, datetime, glob, sys
|
import os, datetime, glob, sys
|
||||||
|
from distutils import log
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
from setuptools.command.sdist import sdist as _sdist
|
||||||
|
|
||||||
|
|
||||||
from awx import __version__
|
from awx import __version__
|
||||||
|
|
||||||
@@ -60,6 +63,48 @@ def proc_data_files(data_files):
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
|
class sdist_awx(_sdist, object):
|
||||||
|
'''
|
||||||
|
Custom sdist command to distribute some files as .pyc only.
|
||||||
|
'''
|
||||||
|
|
||||||
|
def make_release_tree(self, base_dir, files):
|
||||||
|
for f in files[:]:
|
||||||
|
if f.endswith('.egg-info/SOURCES.txt'):
|
||||||
|
files.remove(f)
|
||||||
|
sources_txt_path = f
|
||||||
|
super(sdist_awx, self).make_release_tree(base_dir, files)
|
||||||
|
new_sources_path = os.path.join(base_dir, sources_txt_path)
|
||||||
|
if os.path.isfile(new_sources_path):
|
||||||
|
log.warn('unlinking previous %s', new_sources_path)
|
||||||
|
os.unlink(new_sources_path)
|
||||||
|
log.info('writing new %s', new_sources_path)
|
||||||
|
new_sources = file(new_sources_path, 'w')
|
||||||
|
for line in file(sources_txt_path, 'r'):
|
||||||
|
line = line.strip()
|
||||||
|
if line in self.pyc_only_files:
|
||||||
|
line = line + 'c'
|
||||||
|
new_sources.write(line + '\n')
|
||||||
|
|
||||||
|
def make_distribution(self):
|
||||||
|
self.pyc_only_files = []
|
||||||
|
import py_compile
|
||||||
|
for n, f in enumerate(self.filelist.files[:]):
|
||||||
|
if not f.startswith('awx/'):
|
||||||
|
continue
|
||||||
|
if f.startswith('awx/lib/site-packages'):
|
||||||
|
continue
|
||||||
|
if f.startswith('awx/scripts'):
|
||||||
|
continue
|
||||||
|
if f.startswith('awx/plugins'):
|
||||||
|
continue
|
||||||
|
if f.endswith('.py'):
|
||||||
|
log.info('using pyc for: %s', f)
|
||||||
|
py_compile.compile(f, doraise=True)
|
||||||
|
self.filelist.files[n] = f + 'c'
|
||||||
|
self.pyc_only_files.append(f)
|
||||||
|
super(sdist_awx, self).make_distribution()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='awx',
|
name='awx',
|
||||||
version=__version__.split("-")[0], # FIXME: Should keep full version here?
|
version=__version__.split("-")[0], # FIXME: Should keep full version here?
|
||||||
@@ -107,13 +152,16 @@ setup(
|
|||||||
("%s" % webconfig, ["config/awx.conf"]),
|
("%s" % webconfig, ["config/awx.conf"]),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
options={
|
options = {
|
||||||
'egg_info': {
|
'egg_info': {
|
||||||
'tag_build': '%s' % build_timestamp,
|
'tag_build': '%s' % build_timestamp,
|
||||||
},
|
},
|
||||||
'aliases': {
|
'aliases': {
|
||||||
'dev_build': 'clean --all egg_info sdist',
|
'dev_build': 'clean --all egg_info sdist_awx',
|
||||||
'release_build': 'clean --all egg_info -b "" sdist',
|
'release_build': 'clean --all egg_info -b "" sdist_awx',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
cmdclass = {
|
||||||
|
'sdist_awx': sdist_awx,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user