mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-08 22:06:16 +01:00
Replace unmaintained cmdln.py with a custom code
Cmdln.py is unmaintained for years and uses deprecated optparse. Let's replace it with a simpler custom code. Also remove code that generates man page, we'll replace it with a 3rd party tool.
This commit is contained in:
parent
e469c2c184
commit
be8a5268a8
1710
osc/cmdln.py
1710
osc/cmdln.py
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
61
setup.py
61
setup.py
@ -1,69 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
import distutils.core
|
||||
import gzip
|
||||
import os
|
||||
import setuptools
|
||||
from distutils.command import build, install_data
|
||||
|
||||
import osc.commandline
|
||||
import osc.core
|
||||
|
||||
|
||||
class build_osc(build.build):
|
||||
"""
|
||||
Custom build command which generates man page.
|
||||
"""
|
||||
|
||||
def build_man_page(self):
|
||||
"""
|
||||
"""
|
||||
try:
|
||||
os.makedirs(self.build_base)
|
||||
except OSError:
|
||||
pass
|
||||
man_path = os.path.join(self.build_base, 'osc.1.gz')
|
||||
distutils.log.info('generating %s' % man_path)
|
||||
outfile = gzip.open(man_path, 'wt')
|
||||
osccli = osc.commandline.Osc(stdout=outfile)
|
||||
# FIXME: we cannot call the main method because osc expects an ~/.oscrc
|
||||
# file (this would break builds in environments like the obs)
|
||||
# osccli.main(argv = ['osc','man'])
|
||||
osccli.optparser = osccli.get_optparser()
|
||||
osccli.do_man(None)
|
||||
outfile.close()
|
||||
|
||||
def run(self):
|
||||
super().run()
|
||||
self.build_man_page()
|
||||
|
||||
|
||||
# take a potential build-base option into account (for instance, if osc is
|
||||
# build and installed like this:
|
||||
# python setup.py build --build-base=<dir> ... install ...)
|
||||
class install_data(install_data.install_data):
|
||||
def initialize_options(self):
|
||||
super().initialize_options()
|
||||
self.built_data = None
|
||||
|
||||
def finalize_options(self):
|
||||
super().finalize_options()
|
||||
self.set_undefined_options('build', ('build_base', 'built_data'))
|
||||
data_files = []
|
||||
for f in self.data_files:
|
||||
# f is either a str or a (dir, files) pair
|
||||
# (see distutils.command.install_data.install_data.run)
|
||||
if isinstance(f, str):
|
||||
data_files.append(os.path.join(self.built_data, f))
|
||||
else:
|
||||
data_files.append((f[0], [os.path.join(self.built_data, i) for i in f[1]]))
|
||||
self.data_files = data_files
|
||||
|
||||
|
||||
data_files = []
|
||||
data_files.append((os.path.join('share', 'man', 'man1'), ['osc.1.gz']))
|
||||
|
||||
with open("README.md") as fh:
|
||||
lines = fh.readlines()
|
||||
while lines:
|
||||
@ -77,8 +19,6 @@ with open("README.md") as fh:
|
||||
long_description = "".join(lines)
|
||||
|
||||
cmdclass = {
|
||||
'build': build_osc,
|
||||
'install_data': install_data
|
||||
}
|
||||
|
||||
# keep build deps minimal and be tolerant to missing sphinx
|
||||
@ -104,7 +44,6 @@ setuptools.setup(
|
||||
url='http://en.opensuse.org/openSUSE:OSC',
|
||||
download_url='https://github.com/openSUSE/osc',
|
||||
packages=['osc', 'osc.util'],
|
||||
data_files=data_files,
|
||||
install_requires=['cryptography', 'urllib3'],
|
||||
extras_require={
|
||||
'RPM signature verification': ['rpm'],
|
||||
|
Loading…
Reference in New Issue
Block a user