Update setup.py for easier and safer deploys to PyPI
This commit is contained in:
parent
0de8df03e0
commit
bcf756e1cc
34
setup.py
34
setup.py
|
@ -4,17 +4,45 @@ The setup package to install SeleniumBase dependencies and plugins
|
|||
"""
|
||||
|
||||
from setuptools import setup, find_packages # noqa
|
||||
from os import path
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
this_directory = path.abspath(path.dirname(__file__))
|
||||
this_directory = os.path.abspath(os.path.dirname(__file__))
|
||||
long_description = None
|
||||
try:
|
||||
with open(path.join(this_directory, 'README.md'), 'rb') as f:
|
||||
with open(os.path.join(this_directory, 'README.md'), 'rb') as f:
|
||||
long_description = f.read().decode('utf-8')
|
||||
except IOError:
|
||||
long_description = 'Reliable Browser Automation & Testing Framework'
|
||||
|
||||
if sys.argv[-1] == 'publish':
|
||||
reply = None
|
||||
input_method = input
|
||||
if not sys.version_info[0] >= 3:
|
||||
input_method = raw_input # noqa
|
||||
reply = str(input_method(
|
||||
'>>> Confirm release PUBLISH to PyPI? (yes/no): ')).lower().strip()
|
||||
if reply == 'yes':
|
||||
print("\n*** Checking code health with flake8:\n")
|
||||
flake8_status = os.system("flake8 --exclude=temp")
|
||||
if flake8_status != 0:
|
||||
print("\nWARNING! Fix flake8 issues before publishing to PyPI!\n")
|
||||
sys.exit()
|
||||
else:
|
||||
print("*** No flake8 issues detected. Continuing...")
|
||||
print("\n*** Rebuilding distribution packages: ***\n")
|
||||
os.system('rm -f dist/*.egg; rm -f dist/*.tar.gz; rm -f dist/*.whl')
|
||||
os.system('python setup.py sdist bdist_wheel') # Create new tar/wheel
|
||||
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
|
||||
os.system("python -m pip install 'twine>=1.14.0'")
|
||||
print("\n*** Publishing The Release to PyPI: ***\n")
|
||||
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
|
||||
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
|
||||
else:
|
||||
print("\n>>> The Release was NOT PUBLISHED to PyPI! <<<\n")
|
||||
sys.exit()
|
||||
|
||||
setup(
|
||||
name='seleniumbase',
|
||||
version='1.31.5',
|
||||
|
|
Loading…
Reference in New Issue