mirror of
https://github.com/ansible/awx.git
synced 2026-01-10 15:32:07 -03:30
Create aliases for generating RPM and DEB sdist
Adds the following aliases to assist with packaging-specific sdist. * dev_deb and release_deb - includes only .pyc files * dev_rpm and release_rpm - includes only .py files (later removed by install_lib) The rpm sdist tarball is a traditional source distribution. During the build process, RPM will byte-compile and remove the .py source files. The deb sdist includes only byte-compiled awx python.
This commit is contained in:
parent
f7b7508ecf
commit
54713b1a2e
15
Makefile
15
Makefile
@ -210,11 +210,20 @@ release_clean:
|
||||
-(rm *.tar)
|
||||
-(rm -rf ($RELEASE))
|
||||
|
||||
# Traditional 'sdist'
|
||||
sdist: clean minjs
|
||||
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
||||
$(PYTHON) setup.py release_build; \
|
||||
$(PYTHON) setup.py release_rpm; \
|
||||
else \
|
||||
BUILD=$(BUILD) $(PYTHON) setup.py sdist_awx; \
|
||||
BUILD=$(BUILD) $(PYTHON) setup.py dev_rpm; \
|
||||
fi
|
||||
|
||||
# Differs from 'sdist' because it includes 'byte-compiled' files in the tarball
|
||||
sdist_deb: clean minjs
|
||||
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
||||
$(PYTHON) setup.py release_deb ; \
|
||||
else \
|
||||
BUILD=$(BUILD) $(PYTHON) setup.py dev_deb; \
|
||||
fi
|
||||
|
||||
rpmtar: sdist
|
||||
@ -258,7 +267,7 @@ rpm: rpmtar
|
||||
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
|
||||
-ba rpm-build/$(NAME).spec
|
||||
|
||||
deb: sdist
|
||||
deb: sdist_deb
|
||||
@mkdir -p deb-build
|
||||
@cp dist/$(SDIST_TAR_FILE) deb-build/
|
||||
(cd deb-build && tar zxf $(SDIST_TAR_FILE))
|
||||
|
||||
21
setup.py
21
setup.py
@ -60,7 +60,7 @@ def proc_data_files(data_files):
|
||||
|
||||
#####################################################################
|
||||
|
||||
class sdist_awx(_sdist, object):
|
||||
class sdist_deb(_sdist, object):
|
||||
'''
|
||||
Custom sdist command to distribute some files as .pyc only.
|
||||
'''
|
||||
@ -70,7 +70,7 @@ class sdist_awx(_sdist, object):
|
||||
if f.endswith('.egg-info/SOURCES.txt'):
|
||||
files.remove(f)
|
||||
sources_txt_path = f
|
||||
super(sdist_awx, self).make_release_tree(base_dir, files)
|
||||
super(sdist_deb, 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)
|
||||
@ -79,9 +79,8 @@ class sdist_awx(_sdist, object):
|
||||
new_sources = file(new_sources_path, 'w')
|
||||
for line in file(sources_txt_path, 'r'):
|
||||
line = line.strip()
|
||||
# Include both .py and .pyc files to SOURCES.txt
|
||||
if line in self.pyc_only_files:
|
||||
line = line + '\n' + line + 'c'
|
||||
line = line + 'c'
|
||||
new_sources.write(line + '\n')
|
||||
|
||||
def make_distribution(self):
|
||||
@ -105,9 +104,7 @@ class sdist_awx(_sdist, object):
|
||||
# Replace .py with .pyc file
|
||||
self.filelist.files[n] = f + 'c'
|
||||
self.pyc_only_files.append(f)
|
||||
# Add .py files back to the filelist
|
||||
self.filelist.files.extend(self.pyc_only_files)
|
||||
super(sdist_awx, self).make_distribution()
|
||||
super(sdist_deb, self).make_distribution()
|
||||
|
||||
#####################################################################
|
||||
|
||||
@ -206,12 +203,16 @@ setup(
|
||||
'tag_build': '-%s' % build_timestamp,
|
||||
},
|
||||
'aliases': {
|
||||
'dev_build': 'clean --all egg_info sdist_awx',
|
||||
'release_build': 'clean --all egg_info -b "" sdist_awx',
|
||||
# For RPM builds, don't byte-compile awx ... RPM handles that for us
|
||||
'dev_rpm': 'clean --all egg_info sdist',
|
||||
'release_rpm': 'clean --all egg_info -b "" sdist',
|
||||
# For DEB builds, do byte-compile awx
|
||||
'dev_deb': 'clean --all egg_info sdist_deb',
|
||||
'release_deb': 'clean --all egg_info -b "" sdist_deb',
|
||||
},
|
||||
},
|
||||
cmdclass = {
|
||||
'sdist_awx': sdist_awx,
|
||||
'sdist_deb': sdist_deb,
|
||||
'install_lib': install_lib,
|
||||
},
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user