mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-18 20:27:35 +08:00
add setup.py upload support
This commit is contained in:
55
setup.py
55
setup.py
@@ -1,8 +1,11 @@
|
||||
#encoding: utf-8
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
from shutil import rmtree
|
||||
from httprunner.logger import color_print
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools import Command, find_packages, setup
|
||||
|
||||
about = {}
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
@@ -21,6 +24,48 @@ install_requires = [
|
||||
"colorlog"
|
||||
]
|
||||
|
||||
class UploadCommand(Command):
|
||||
""" Build and publish this package.
|
||||
Support setup.py upload. Copied from requests_html.
|
||||
"""
|
||||
|
||||
user_options = []
|
||||
|
||||
@staticmethod
|
||||
def status(s):
|
||||
"""Prints things in yellow color."""
|
||||
color_print(s, "yellow")
|
||||
|
||||
def initialize_options(self):
|
||||
""" override
|
||||
"""
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
""" override
|
||||
"""
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
self.status('Removing previous builds…')
|
||||
rmtree(os.path.join(here, 'dist'))
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
self.status('Building Source and Wheel (universal) distribution…')
|
||||
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
|
||||
|
||||
self.status('Uploading the package to PyPi via Twine…')
|
||||
os.system('twine upload dist/*')
|
||||
|
||||
self.status('Publishing git tags…')
|
||||
os.system('git tag v{0}'.format(about['__version__']))
|
||||
os.system('git push --tags')
|
||||
|
||||
sys.exit()
|
||||
|
||||
|
||||
setup(
|
||||
name=about['__title__'],
|
||||
version=about['__version__'],
|
||||
@@ -30,11 +75,13 @@ setup(
|
||||
author_email=about['__author_email__'],
|
||||
url=about['__url__'],
|
||||
license=about['__license__'],
|
||||
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
|
||||
packages=find_packages(exclude=["examples", "tests", "tests.*"]),
|
||||
package_data={
|
||||
'': ["README.rst"],
|
||||
'httprunner': ["templates/*"],
|
||||
},
|
||||
keywords='api test',
|
||||
keywords='HTTP api test requests locust',
|
||||
install_requires=install_requires,
|
||||
extras_require={
|
||||
'dev': ['flask']
|
||||
@@ -53,5 +100,9 @@ setup(
|
||||
'hrun=httprunner.cli:main_hrun',
|
||||
'locusts=httprunner.cli:main_locust'
|
||||
]
|
||||
},
|
||||
# $ setup.py upload support.
|
||||
cmdclass={
|
||||
'upload': UploadCommand
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user