mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
Switch to dh-python2 and remove py files during packaging
This commit is contained in:
3
Makefile
3
Makefile
@@ -276,7 +276,7 @@ release_clean:
|
|||||||
-(rm -rf ($RELEASE))
|
-(rm -rf ($RELEASE))
|
||||||
|
|
||||||
dist/$(SDIST_TAR_FILE):
|
dist/$(SDIST_TAR_FILE):
|
||||||
BYTE_COMPILE=$(BYTE_COMPILE) BUILD="$(BUILD)" $(PYTHON) setup.py sdist
|
BUILD="$(BUILD)" $(PYTHON) setup.py sdist
|
||||||
|
|
||||||
sdist: minjs dist/$(SDIST_TAR_FILE)
|
sdist: minjs dist/$(SDIST_TAR_FILE)
|
||||||
|
|
||||||
@@ -321,7 +321,6 @@ deb-build/$(SDIST_TAR_NAME):
|
|||||||
cp -a packaging/debian deb-build/$(SDIST_TAR_NAME)/
|
cp -a packaging/debian deb-build/$(SDIST_TAR_NAME)/
|
||||||
sed -ie "s#^$(NAME) (\([^)]*\)) \([^;]*\);#$(NAME) ($(VERSION)-$(DEB_RELEASE)) $(DEB_DIST);#" deb-build/$(SDIST_TAR_NAME)/debian/changelog
|
sed -ie "s#^$(NAME) (\([^)]*\)) \([^;]*\);#$(NAME) ($(VERSION)-$(DEB_RELEASE)) $(DEB_DIST);#" deb-build/$(SDIST_TAR_NAME)/debian/changelog
|
||||||
|
|
||||||
# debian: BYTE_COMPILE = 1
|
|
||||||
debian: sdist deb-build/$(SDIST_TAR_NAME)
|
debian: sdist deb-build/$(SDIST_TAR_NAME)
|
||||||
|
|
||||||
deb-build/$(NAME)_$(VERSION)-$(DEB_RELEASE)_all.deb:
|
deb-build/$(NAME)_$(VERSION)-$(DEB_RELEASE)_all.deb:
|
||||||
|
|||||||
78
setup.py
78
setup.py
@@ -125,48 +125,52 @@ class sdist_pyc_only(_sdist, object):
|
|||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
from distutils.command.install_lib import install_lib as _install_lib
|
if os.getenv('RPM_PACKAGE_NAME', False) == 'ansible-tower':
|
||||||
|
|
||||||
class install_lib(_install_lib, object):
|
from distutils.command.install_lib import install_lib as _install_lib
|
||||||
'''
|
class install_lib(_install_lib, object):
|
||||||
Custom install_lib command to distribute some files as .pyc only.
|
|
||||||
'''
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
'''
|
'''
|
||||||
Overload the run method and remove all .py files after compilation
|
Custom install_lib command to distribute some files as .pyc only.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
super(install_lib, self).run()
|
def run(self):
|
||||||
for f in self.install():
|
'''
|
||||||
if not f.startswith(self.install_dir + 'awx/'):
|
Overload the run method and remove all .py files after compilation
|
||||||
log.debug('install_lib skipping: %s', f)
|
'''
|
||||||
continue
|
|
||||||
if f.startswith(self.install_dir + 'awx/lib/site-packages'):
|
|
||||||
log.debug('install_lib skipping: %s', f)
|
|
||||||
continue
|
|
||||||
if f.startswith(self.install_dir + 'awx/scripts'):
|
|
||||||
log.debug('install_lib skipping: %s', f)
|
|
||||||
continue
|
|
||||||
if f.startswith(self.install_dir + 'awx/plugins'):
|
|
||||||
log.debug('install_lib skipping: %s', f)
|
|
||||||
continue
|
|
||||||
if f.startswith(self.install_dir + 'awx/main/tests/data'):
|
|
||||||
log.debug('install_lib skipping: %s', f)
|
|
||||||
continue
|
|
||||||
if f.endswith('.py'):
|
|
||||||
log.info('install_lib removing: %s', f)
|
|
||||||
os.unlink(f)
|
|
||||||
|
|
||||||
def get_outputs(self):
|
super(install_lib, self).run()
|
||||||
'''
|
for f in self.install():
|
||||||
Overload the get_outputs method and remove any .py entries in the file
|
if not f.startswith(self.install_dir + 'awx/'):
|
||||||
list
|
log.debug('install_lib skipping: %s', f)
|
||||||
'''
|
continue
|
||||||
|
if f.startswith(self.install_dir + 'awx/lib/site-packages'):
|
||||||
|
log.debug('install_lib skipping: %s', f)
|
||||||
|
continue
|
||||||
|
if f.startswith(self.install_dir + 'awx/scripts'):
|
||||||
|
log.debug('install_lib skipping: %s', f)
|
||||||
|
continue
|
||||||
|
if f.startswith(self.install_dir + 'awx/plugins'):
|
||||||
|
log.debug('install_lib skipping: %s', f)
|
||||||
|
continue
|
||||||
|
if f.startswith(self.install_dir + 'awx/main/tests/data'):
|
||||||
|
log.debug('install_lib skipping: %s', f)
|
||||||
|
continue
|
||||||
|
if f.endswith('.py'):
|
||||||
|
log.info('install_lib removing: %s', f)
|
||||||
|
os.unlink(f)
|
||||||
|
|
||||||
filenames = super(install_lib, self).get_outputs()
|
def get_outputs(self):
|
||||||
return [filename for filename in filenames
|
'''
|
||||||
if not filename.endswith('.py')]
|
Overload the get_outputs method and remove any .py entries in the file
|
||||||
|
list
|
||||||
|
'''
|
||||||
|
|
||||||
|
filenames = super(install_lib, self).get_outputs()
|
||||||
|
return [filename for filename in filenames
|
||||||
|
if not filename.endswith('.py')]
|
||||||
|
else:
|
||||||
|
|
||||||
|
from distutils.command.install_lib import install_lib
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
@@ -237,7 +241,7 @@ setup(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
'sdist': os.getenv('BYTE_COMPILE', False) in (True, 1, 'True', '1') and sdist_pyc_only or _sdist,
|
'sdist': _sdist,
|
||||||
'install_lib': install_lib,
|
'install_lib': install_lib,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user