mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 11:27:36 -02: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:
15
Makefile
15
Makefile
@@ -210,11 +210,20 @@ release_clean:
|
|||||||
-(rm *.tar)
|
-(rm *.tar)
|
||||||
-(rm -rf ($RELEASE))
|
-(rm -rf ($RELEASE))
|
||||||
|
|
||||||
|
# Traditional 'sdist'
|
||||||
sdist: clean minjs
|
sdist: clean minjs
|
||||||
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
if [ "$(OFFICIAL)" = "yes" ] ; then \
|
||||||
$(PYTHON) setup.py release_build; \
|
$(PYTHON) setup.py release_rpm; \
|
||||||
else \
|
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
|
fi
|
||||||
|
|
||||||
rpmtar: sdist
|
rpmtar: sdist
|
||||||
@@ -258,7 +267,7 @@ rpm: rpmtar
|
|||||||
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
|
--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
|
||||||
-ba rpm-build/$(NAME).spec
|
-ba rpm-build/$(NAME).spec
|
||||||
|
|
||||||
deb: sdist
|
deb: sdist_deb
|
||||||
@mkdir -p deb-build
|
@mkdir -p deb-build
|
||||||
@cp dist/$(SDIST_TAR_FILE) deb-build/
|
@cp dist/$(SDIST_TAR_FILE) deb-build/
|
||||||
(cd deb-build && tar zxf $(SDIST_TAR_FILE))
|
(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.
|
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'):
|
if f.endswith('.egg-info/SOURCES.txt'):
|
||||||
files.remove(f)
|
files.remove(f)
|
||||||
sources_txt_path = 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)
|
new_sources_path = os.path.join(base_dir, sources_txt_path)
|
||||||
if os.path.isfile(new_sources_path):
|
if os.path.isfile(new_sources_path):
|
||||||
log.warn('unlinking previous %s', 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')
|
new_sources = file(new_sources_path, 'w')
|
||||||
for line in file(sources_txt_path, 'r'):
|
for line in file(sources_txt_path, 'r'):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
# Include both .py and .pyc files to SOURCES.txt
|
|
||||||
if line in self.pyc_only_files:
|
if line in self.pyc_only_files:
|
||||||
line = line + '\n' + line + 'c'
|
line = line + 'c'
|
||||||
new_sources.write(line + '\n')
|
new_sources.write(line + '\n')
|
||||||
|
|
||||||
def make_distribution(self):
|
def make_distribution(self):
|
||||||
@@ -105,9 +104,7 @@ class sdist_awx(_sdist, object):
|
|||||||
# Replace .py with .pyc file
|
# Replace .py with .pyc file
|
||||||
self.filelist.files[n] = f + 'c'
|
self.filelist.files[n] = f + 'c'
|
||||||
self.pyc_only_files.append(f)
|
self.pyc_only_files.append(f)
|
||||||
# Add .py files back to the filelist
|
super(sdist_deb, self).make_distribution()
|
||||||
self.filelist.files.extend(self.pyc_only_files)
|
|
||||||
super(sdist_awx, self).make_distribution()
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
@@ -206,12 +203,16 @@ setup(
|
|||||||
'tag_build': '-%s' % build_timestamp,
|
'tag_build': '-%s' % build_timestamp,
|
||||||
},
|
},
|
||||||
'aliases': {
|
'aliases': {
|
||||||
'dev_build': 'clean --all egg_info sdist_awx',
|
# For RPM builds, don't byte-compile awx ... RPM handles that for us
|
||||||
'release_build': 'clean --all egg_info -b "" sdist_awx',
|
'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 = {
|
cmdclass = {
|
||||||
'sdist_awx': sdist_awx,
|
'sdist_deb': sdist_deb,
|
||||||
'install_lib': install_lib,
|
'install_lib': install_lib,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user