Moving publish command to setup.py

This commit is contained in:
Roman Mogilatov 2015-04-03 16:11:05 +03:00
parent e38d2664ea
commit 5116a57aea
2 changed files with 71 additions and 49 deletions

View File

@ -10,7 +10,7 @@ manager = Manager()
@manager.command @manager.command
def publish(with_tag=True): def publish(with_tag=True):
"""Publish current version to PyPi.""" """Publishg current version to PyPi."""
os.system('python setup.py sdist upload') os.system('python setup.py sdist upload')
if with_tag: if with_tag:
tag() tag()

118
setup.py
View File

@ -2,18 +2,20 @@
`Objects` setup script. `Objects` setup script.
""" """
import os
from setuptools import setup from setuptools import setup
from setuptools import Command
DESCRIPTION = 'Dependency management tool for Python projects' SHORT_DESCRIPTION = 'Dependency management tool for Python projects'
# Getting description. # Getting description.
with open('README.rst') as readme_file: with open('README.rst') as readme_file:
description = readme_file.read() description = readme_file.read()
# Removing duplicated description # Removing duplicated short description.
description = description.replace(DESCRIPTION, '') description = description.replace(SHORT_DESCRIPTION, '')
# Getting requirements. # Getting requirements.
@ -26,48 +28,68 @@ with open('VERSION') as version:
version = version.read().strip() version = version.read().strip()
if __name__ == '__main__': class PublishCommand(Command):
setup(
name='Objects', """Setuptools `publish` command."""
version=version,
description='Dependency management tool for Python projects', description = "Publish current distribution to PyPi and create tag"
long_description=description, user_options = tuple()
author='Roman Mogilatov',
author_email='rmogilatov@gmail.com', def initialize_options(self):
maintainer='Roman Mogilatov', """Init options."""
maintainer_email='rmogilatov@gmail.com',
url='https://github.com/rmk135/objects', def finalize_options(self):
license='BSD New', """Finalize options."""
packages=['objects'],
zip_safe=True, def run(self):
install_requires=requirements, """Command execution."""
keywords=['Dependency management', os.system('python setup.py sdist upload')
'Dependency injection', os.system('git tag -a {0} -m \'version {0}\''.format(version))
'Dependency injection container', os.system('git push --tags')
'DI',
'DIC',
'Dependency injector', setup(name='Objects',
'Inversion of Control', version=version,
'Inversion of Control container', description=SHORT_DESCRIPTION,
'IoC', long_description=description,
'IoC container'], author='Roman Mogilatov',
classifiers=[ author_email='rmogilatov@gmail.com',
'Development Status :: 3 - Alpha', maintainer='Roman Mogilatov',
'Intended Audience :: Developers', maintainer_email='rmogilatov@gmail.com',
'License :: OSI Approved :: BSD License', url='https://github.com/rmk135/objects',
'Operating System :: OS Independent', license='BSD New',
'Programming Language :: Python', packages=['objects'],
'Programming Language :: Python :: 2', zip_safe=True,
'Programming Language :: Python :: 2.6', install_requires=requirements,
'Programming Language :: Python :: 2.7', cmdclass={
'Programming Language :: Python :: 3', 'publish': PublishCommand,
'Programming Language :: Python :: 3.2', },
'Programming Language :: Python :: 3.3', keywords=['Dependency management',
'Programming Language :: Python :: 3.4', 'Dependency injection',
'Programming Language :: Python :: Implementation :: CPython', 'Dependency injection container',
'Programming Language :: Python :: Implementation :: PyPy', 'DI',
'Topic :: Software Development', 'DIC',
'Topic :: Software Development :: Libraries', 'Dependency injector',
'Topic :: Software Development :: Libraries :: Python Modules', 'Inversion of Control',
] 'Inversion of Control container',
) 'IoC',
'IoC container'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
])