1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

[python3] setup.py now supports python3

This commit is contained in:
lethliel 2018-12-13 13:15:31 +01:00
parent 7bd9ca485d
commit 36ab05c222

View File

@ -2,11 +2,13 @@
from distutils.core import setup from distutils.core import setup
import distutils.core import distutils.core
import distutils.command.build from distutils.command import build, install_data
import distutils.command.install_data
import os.path import os.path
import osc.core import osc.core
import sys import sys
import setuptools
from osc import commandline from osc import commandline
from osc import babysitter from osc import babysitter
# optional support for py2exe # optional support for py2exe
@ -17,7 +19,7 @@ except:
HAVE_PY2EXE = False HAVE_PY2EXE = False
class build_osc(distutils.command.build.build, object): class build_osc(build.build, object):
""" """
Custom build command which generates man page. Custom build command which generates man page.
""" """
@ -28,7 +30,7 @@ class build_osc(distutils.command.build.build, object):
import gzip import gzip
man_path = os.path.join(self.build_base, 'osc.1.gz') man_path = os.path.join(self.build_base, 'osc.1.gz')
distutils.log.info('generating %s' % man_path) distutils.log.info('generating %s' % man_path)
outfile = gzip.open(man_path, 'w') outfile = gzip.open(man_path, 'wt')
osccli = commandline.Osc(stdout=outfile) osccli = commandline.Osc(stdout=outfile)
# FIXME: we cannot call the main method because osc expects an ~/.oscrc # FIXME: we cannot call the main method because osc expects an ~/.oscrc
# file (this would break builds in environments like the obs) # file (this would break builds in environments like the obs)
@ -60,15 +62,15 @@ class build_docs(distutils.core.Command):
src_dir = (self.distribution.package_dir or {'': ''})[''] src_dir = (self.distribution.package_dir or {'': ''})['']
src_dir = os.path.join(os.getcwd(), src_dir) src_dir = os.path.join(os.getcwd(), src_dir)
import sphinx import sphinx
sphinx.main(['runme', sphinx.main(['runme',
'-D', 'version=%s' % metadata.get_version(), '-D', 'version=%s' % metadata.get_version(),
os.path.join('docs',), os.path.join(self.built_docs, 'docs')]) os.path.join('docs',), os.path.join(self.built_docs, 'docs')])
# take a potential build-base option into account (for instance, if osc is # take a potential build-base option into account (for instance, if osc is
# build and installed like this: # build and installed like this:
# python setup.py build --build-base=<dir> ... install ...) # python setup.py build --build-base=<dir> ... install ...)
class install_data(distutils.command.install_data.install_data, object): class install_data(install_data.install_data, object):
def initialize_options(self): def initialize_options(self):
super(install_data, self).initialize_options() super(install_data, self).initialize_options()
self.built_data = None self.built_data = None
@ -97,7 +99,7 @@ data_files = []
if sys.platform[:3] != 'win': if sys.platform[:3] != 'win':
data_files.append((os.path.join('share', 'man', 'man1'), ['osc.1.gz'])) data_files.append((os.path.join('share', 'man', 'man1'), ['osc.1.gz']))
setup(name='osc', setuptools.setup(name='osc',
version = osc.core.__version__, version = osc.core.__version__,
description = 'openSUSE commander', description = 'openSUSE commander',
long_description = 'Command-line client for the openSUSE Build Service, which allows to access repositories in the openSUSE Build Service in similar way as Subversion repositories.', long_description = 'Command-line client for the openSUSE Build Service, which allows to access repositories in the openSUSE Build Service in similar way as Subversion repositories.',