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

Automatic package publication via Travis CI

* `.travis.yml`
  - Reformatted for easier reading
  - Used `before_*` statements instead of script chains
  - Publish only source packages
* `setup.py`
  - Reformatted for easier reading
  - Use README contents for `long_description` to have a nice description on PyPI
  - Added classifiers
  - Added explicit package dependencies
* fixes #658
* fixes #708
This commit is contained in:
Andreas Hasenkopf 2020-02-13 14:41:15 +01:00
parent 9b0dcf3535
commit f817db1053
3 changed files with 72 additions and 34 deletions

View File

@ -1,13 +1,18 @@
language: python
python:
- '2.7'
- '3.6'
- '2.7'
- '3.6'
- '3.7'
addons:
apt:
packages:
- diffstat
- diffstat
sudo: false
script: cd tests; python suite.py
before_script: cd $TRAVIS_BUILD_DIR/tests
script: python suite.py
before_deploy:
- cd $TRAVIS_BUILD_DIR/
- rm -rf $TRAVIS_BUILD_DIR/dist/*
deploy:
provider: pypi
user: suse
@ -15,5 +20,5 @@ deploy:
secure: R4+YNPW2tsiY06hibGvONYn0//1z1QdcY8VmNbYpIRly4eTAbPE9uejKpyuflUkznpEkoqCdFzi5FNFhgat9N+AkIKyX9NTkf0oxaKKbdqBM7H1V8bqLYlAO479262spRyO0ee5fV5v6g81AFjncIV+pGjtQ0Vg/sjVcvGa61bs=
on:
tags: true
distributions: sdist bdist_wheel
distributions: sdist
repo: openSUSE/osc

4
MANIFEST.in Normal file
View File

@ -0,0 +1,4 @@
include NEWS
include README
include AUTHORS
include COPYING

View File

@ -3,17 +3,19 @@
from distutils.core import setup
import distutils.core
from distutils.command import build, install_data
import gzip
import os.path
import osc.core
import sys
import setuptools
import osc.core
from osc import commandline
from osc import babysitter
# optional support for py2exe
try:
import py2exe
HAVE_PY2EXE = True
except:
HAVE_PY2EXE = False
@ -27,14 +29,13 @@ class build_osc(build.build, object):
def build_man_page(self):
"""
"""
import gzip
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 = 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.main(argv = ['osc','man'])
osccli.optparser = osccli.get_optparser()
osccli.do_man(None)
outfile.close()
@ -60,11 +61,11 @@ class build_docs(distutils.core.Command):
metadata = self.distribution.metadata
# package_dir may be None, in that case use the current directory.
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
sphinx.main(['runme',
'-D', 'version=%s' % metadata.get_version(),
os.path.join('docs',), os.path.join(self.built_docs, 'docs')])
'-D', 'version=%s' % metadata.get_version(),
os.path.join('docs', ), os.path.join(self.built_docs, 'docs')])
# take a potential build-base option into account (for instance, if osc is
@ -91,34 +92,62 @@ class install_data(install_data.install_data, object):
addparams = {}
if HAVE_PY2EXE:
addparams['console'] = [{'script': 'osc-wrapper.py', 'dest_base': 'osc', 'icon_resources': [(1, 'osc.ico')]}]
addparams['console'] = [
{'script': 'osc-wrapper.py', 'dest_base': 'osc', 'icon_resources': [(1, 'osc.ico')]}]
addparams['zipfile'] = 'shared.lib'
addparams['options'] = {'py2exe': {'optimize': 0, 'compressed': True, 'packages': ['xml.etree', 'StringIO', 'gzip']}}
addparams['options'] = {'py2exe': {'optimize': 0, 'compressed': True,
'packages': ['xml.etree', 'StringIO', 'gzip']}}
data_files = []
if sys.platform[:3] != 'win':
data_files.append((os.path.join('share', 'man', 'man1'), ['osc.1.gz']))
setuptools.setup(name='osc',
version = osc.core.__version__,
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.',
author = 'openSUSE project',
author_email = 'opensuse-buildservice@opensuse.org',
license = 'GPL',
platforms = ['Linux', 'Mac OSX', 'Windows XP/2000/NT', 'Windows 95/98/ME', 'FreeBSD'],
keywords = ['openSUSE', 'SUSE', 'RPM', 'build', 'buildservice'],
url = 'http://en.opensuse.org/openSUSE:OSC',
download_url = 'https://github.com/openSUSE/osc',
packages = ['osc', 'osc.util'],
scripts = ['osc-wrapper.py'],
data_files = data_files,
with open("README") as fh:
long_description = fh.read()
# Override certain command classes with our own ones
cmdclass = {
setuptools.setup(
name='osc',
version=osc.core.__version__,
description='openSUSE commander',
long_description=long_description,
long_description_content_type="text/plain",
author='openSUSE project',
author_email='opensuse-buildservice@opensuse.org',
license='GPL',
platforms=['Linux', 'Mac OSX', 'Windows XP/2000/NT', 'Windows 95/98/ME', 'FreeBSD'],
keywords=['openSUSE', 'SUSE', 'RPM', 'build', 'buildservice'],
url='http://en.opensuse.org/openSUSE:OSC',
download_url='https://github.com/openSUSE/osc',
packages=['osc', 'osc.util'],
scripts=['osc-wrapper.py'],
data_files=data_files,
install_requires=['M2Crypto', 'chardet'],
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Archiving :: Packaging",
],
# Override certain command classes with our own ones
cmdclass={
'build': build_osc,
'build_docs' : build_docs,
'build_docs': build_docs,
'install_data': install_data
},
**addparams
)
},
**addparams
)