kiwi-el8/setup.py
Marcus Schäfer cc19266600
Cleanup setup.py
The way kiwi uses setup.py assumes that pip runs this script
like a spec file in rpm is processed. However this is not the
case given that pip implicitly creates a static zip file called
wheel which looses all the code logic done in setup.py. Therefore
setup.py should not contain code that needs to run at install
time. Of course this change comes with an effect which is that
the following files will not be available when installing kiwi
from pip:

* man pages: /usr/share/man/man8/...
* command completion: /etc/bash_completion.d/kiwi-ng.sh
* kiwi default config file: /etc/kiwi.yml
* package docs: /usr/share/doc/packages/kiwi-ng/...
  (kiwi.pdf, LICENSE, README)

kiwi stays fully functional without this information. It is
expected that the installation of kiwi as a service will
be done by a package and its package manager. When using kiwi
from pip it is designed to provide a python module but not
a complete user application. The way pip and wheels interact
with each other seems to demonstrate that pip is not a
package manager but more a python module manager.

This Fixes #1415
2020-07-03 10:27:57 +02:00

99 lines
2.8 KiB
Python
Executable File

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from setuptools import setup
from setuptools.command import sdist as setuptools_sdist
import distutils
import subprocess
from kiwi.version import __version__
class sdist(setuptools_sdist.sdist):
"""
Custom sdist command
Host requirements: git
"""
def run(self):
"""
Run first the git commit format update $Format:%H$
and after that the usual Python sdist
"""
# git attributes
command = ['make', 'git_attributes']
self.announce(
'Running make git_attributes target: %s' % str(command),
level=distutils.log.INFO
)
self.announce(
subprocess.check_output(command).decode(),
level=distutils.log.INFO
)
# standard sdist process
setuptools_sdist.sdist.run(self)
# cleanup attributes
command = ['make', 'clean_git_attributes']
self.announce(
subprocess.check_output(command).decode(),
level=distutils.log.INFO
)
config = {
'name': 'kiwi',
'description': 'KIWI - Appliance Builder (next generation)',
'author': 'Marcus Schaefer',
'url': 'https://osinside.github.io/kiwi',
'download_url':
'https://download.opensuse.org/repositories/'
'Virtualization:/Appliances:/Builder',
'author_email': 'ms@suse.com',
'version': __version__,
'license' : 'GPLv3+',
'install_requires': [
'docopt>=0.6.2',
'lxml',
'pyxattr',
'requests',
'PyYAML'
],
'packages': ['kiwi'],
'cmdclass': {
'sdist': sdist
},
'entry_points': {
'kiwi.tasks': [
'image_info=kiwi.tasks.image_info',
'image_resize=kiwi.tasks.image_resize',
'result_bundle=kiwi.tasks.result_bundle',
'result_list=kiwi.tasks.result_list',
'system_build=kiwi.tasks.system_build',
'system_create=kiwi.tasks.system_create',
'system_prepare=kiwi.tasks.system_prepare',
'system_update=kiwi.tasks.system_update'
],
'console_scripts': [
'kiwi-ng=kiwi.kiwi:main',
'kiwicompat=kiwi.kiwi_compat:main'
]
},
'include_package_data': True,
'zip_safe': False,
'classifiers': [
# classifier: http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: '
'GNU General Public License v3 or later (GPLv3+)',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: System :: Operating System',
]
}
setup(**config)