From ef319ec48fd372b0caef70c3d74ed322cdf832a2 Mon Sep 17 00:00:00 2001 From: Hervé Beraud Date: Jan 18 2019 13:43:02 +0000 Subject: Refactor packaging by introducing pbr. Since python-daemon distribution facing issues related to dependances management this commit try to avoid this kind of problem and try to simplify the project release management by using pbr. This commit introduce: - packaging metadata management by using configuration file; - introduce PEP 516; - introduce requirements file; - convert README to rst format for a better visualization on pagure and better compatibility with pbr. Using it: - install pbr (pip install pbr); - create a new tag (git tag 9.9.9)(by example); - build and dist (python setup.py build && python setup.py sdist); - publish your release on pypi by using twine or whatever you want. pbr[1] allow simplify python packaging by automatizing: - semver[2] management; - changelog generation; - authors file generation. [1] https://docs.openstack.org/pbr/latest/ [2] https://semver.org/ Co-authored-by: Hobbestigrou --- diff --git a/README b/README deleted file mode 100644 index 2b870b6..0000000 --- a/README +++ /dev/null @@ -1,67 +0,0 @@ -############# -python-daemon -############# - -Library to implement a well-behaved Unix daemon process -####################################################### - -This library implements the well-behaved daemon specification of -:pep:`3143`, “Standard daemon process library”. - -A well-behaved Unix daemon process is tricky to get right, but the -required steps are much the same for every daemon program. A -`DaemonContext` instance holds the behaviour and configured process -environment for the program; use the instance as a context manager to -enter a daemon state. - -Simple example of usage:: - - import daemon - - from spam import do_main_program - - with daemon.DaemonContext(): - do_main_program() - -Customisation of the steps to become a daemon is available by setting -options on the `DaemonContext` instance; see the documentation for -that class for each option. - - -Copying -======= - -This work, ‘python-daemon’, is free software: you may copy, modify, -and/or distribute this work under certain conditions; see the relevant -files for specific grant of license. No warranty expressed or implied. - -* Parts of this work are licensed to you under the terms of the GNU - General Public License as published by the Free Software Foundation; - version 3 of that license or any later version. - See the file ‘LICENSE.GPL-3’ for details. - -* Parts of this work are licensed to you under the terms of the Apache - License, version 2.0 as published by the Apache Software Foundation. - See the file ‘LICENSE.ASF-2’ for details. - - -.. - This document is written using `reStructuredText`_ markup, and can - be rendered with `Docutils`_ to other formats. - - .. _Docutils: http://docutils.sourceforge.net/ - .. _reStructuredText: http://docutils.sourceforge.net/rst.html - -.. - This is free software: you may copy, modify, and/or distribute this work - under the terms of the Apache License version 2.0 as published by the - Apache Software Foundation. - No warranty expressed or implied. See the file ‘LICENSE.ASF-2’ for details. - -.. - Local variables: - coding: utf-8 - mode: text - mode: rst - End: - vim: fileencoding=utf-8 filetype=rst : diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..2b870b6 --- /dev/null +++ b/README.rst @@ -0,0 +1,67 @@ +############# +python-daemon +############# + +Library to implement a well-behaved Unix daemon process +####################################################### + +This library implements the well-behaved daemon specification of +:pep:`3143`, “Standard daemon process library”. + +A well-behaved Unix daemon process is tricky to get right, but the +required steps are much the same for every daemon program. A +`DaemonContext` instance holds the behaviour and configured process +environment for the program; use the instance as a context manager to +enter a daemon state. + +Simple example of usage:: + + import daemon + + from spam import do_main_program + + with daemon.DaemonContext(): + do_main_program() + +Customisation of the steps to become a daemon is available by setting +options on the `DaemonContext` instance; see the documentation for +that class for each option. + + +Copying +======= + +This work, ‘python-daemon’, is free software: you may copy, modify, +and/or distribute this work under certain conditions; see the relevant +files for specific grant of license. No warranty expressed or implied. + +* Parts of this work are licensed to you under the terms of the GNU + General Public License as published by the Free Software Foundation; + version 3 of that license or any later version. + See the file ‘LICENSE.GPL-3’ for details. + +* Parts of this work are licensed to you under the terms of the Apache + License, version 2.0 as published by the Apache Software Foundation. + See the file ‘LICENSE.ASF-2’ for details. + + +.. + This document is written using `reStructuredText`_ markup, and can + be rendered with `Docutils`_ to other formats. + + .. _Docutils: http://docutils.sourceforge.net/ + .. _reStructuredText: http://docutils.sourceforge.net/rst.html + +.. + This is free software: you may copy, modify, and/or distribute this work + under the terms of the Apache License version 2.0 as published by the + Apache Software Foundation. + No warranty expressed or implied. See the file ‘LICENSE.ASF-2’ for details. + +.. + Local variables: + coding: utf-8 + mode: text + mode: rst + End: + vim: fileencoding=utf-8 filetype=rst : diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..64ed2a0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +lockfile>=0.10 diff --git a/setup.cfg b/setup.cfg index 1b14719..74e1b68 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,42 @@ # setup.cfg # Python Distutils configuration options for this distribution. +[metadata] +name = python-daemon +home-page = https://pagure.io/python-daemon/ +summary = Library to implement a well-behaved Unix daemon process +description-file = + README.rst +author = Ben Finney +author-email = ben+python@benfinney.id.au +license = Apache License 2.0 +classifier = + Development Status :: 5 - Production/Stable + Intended Audience :: Developers + License :: OSI Approved :: Apache Software License + Operating System :: POSIX + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Software Development :: Libraries :: Python Modules +keywords = + daemon + fork + unix + +[files] +packages = + daemon + +[extras] +devel= + pbr + tox + +[pbr] + skip_authors = 1 + skip_changelog = 1 [aliases] distribute = register sdist bdist_wheel upload @@ -13,10 +50,3 @@ universal = true # Sign distributions, and upload the signing public key? sign = true - - -# Local variables: -# coding: utf-8 -# mode: conf -# End: -# vim: fileencoding=utf-8 filetype=conf : diff --git a/setup.py b/setup.py index b5bae5f..c6404f2 100644 --- a/setup.py +++ b/setup.py @@ -9,99 +9,27 @@ """ Distribution setup for ‘python-daemon’ library. """ -from __future__ import (absolute_import, unicode_literals) import os.path -import pydoc -import sys import unittest -from setuptools import (setup, find_packages) +from setuptools import setup -import version - -fromlist_expects_type = str -if sys.version_info < (3, 0): - fromlist_expects_type = bytes - - -main_module_name = 'daemon' -main_module_fromlist = list(map(fromlist_expects_type, [ - '_metadata'])) -main_module = __import__( - main_module_name, - level=0, fromlist=main_module_fromlist) -metadata = main_module._metadata - -(synopsis, long_description) = pydoc.splitdoc(pydoc.getdoc(main_module)) - - def test_suite(): """ Make the test suite for this code base. """ loader = unittest.TestLoader() suite = loader.discover(os.path.curdir, pattern='test_*.py') return suite - -setup_kwargs = dict( - distclass=version.ChangelogAwareDistribution, - name=metadata.distribution_name, - packages=find_packages(exclude=["test"]), - cmdclass={ - "write_version_info": version.WriteVersionInfoCommand, - "egg_info": version.EggInfoCommand, - "build": version.BuildCommand, - }, - - # Setuptools metadata. - zip_safe=False, - setup_requires=[ - "docutils", - ], - test_suite="setup.test_suite", - tests_require=[ - "unittest2 >=0.5.1", - "testtools", - "testscenarios >=0.4", - "mock >=1.3", - "docutils", - ], - install_requires=[ - "setuptools", - "lockfile >=0.10", - ], - # PyPI metadata. - author=metadata.author_name, - author_email=metadata.author_email, - description=synopsis, - license=metadata.license, - keywords="daemon fork unix".split(), - url=metadata.url, - long_description=long_description, - classifiers=[ - # Reference: - "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: Apache Software License", - "Operating System :: POSIX", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - ) +setup( + setup_requires=["pbr"], + pbr=True, + test_suite='setup.test_suite' +) -# Docutils is only required for building, but Setuptools can't distinguish -# dependencies properly. -# See . -setup_kwargs['install_requires'].append("docutils") - -if __name__ == '__main__': - setup(**setup_kwargs) - - # Copyright © 2008–2018 Ben Finney # # This is free software: you may copy, modify, and/or distribute this work