|
4 | 4 | """
|
5 | 5 |
|
6 | 6 | from setuptools import setup, find_packages # noqa
|
7 |
| -from os import path |
| 7 | +import os |
| 8 | +import sys |
8 | 9 |
|
9 | 10 |
|
10 |
| -this_directory = path.abspath(path.dirname(__file__)) |
| 11 | +this_directory = os.path.abspath(os.path.dirname(__file__)) |
11 | 12 | long_description = None
|
12 | 13 | try:
|
13 |
| - with open(path.join(this_directory, 'README.md'), 'rb') as f: |
| 14 | + with open(os.path.join(this_directory, 'README.md'), 'rb') as f: |
14 | 15 | long_description = f.read().decode('utf-8')
|
15 | 16 | except IOError:
|
16 | 17 | long_description = 'Reliable Browser Automation & Testing Framework'
|
17 | 18 |
|
| 19 | +if sys.argv[-1] == 'publish': |
| 20 | + reply = None |
| 21 | + input_method = input |
| 22 | + if not sys.version_info[0] >= 3: |
| 23 | + input_method = raw_input # noqa |
| 24 | + reply = str(input_method( |
| 25 | + '>>> Confirm release PUBLISH to PyPI? (yes/no): ')).lower().strip() |
| 26 | + if reply == 'yes': |
| 27 | + print("\n*** Checking code health with flake8:\n") |
| 28 | + flake8_status = os.system("flake8 --exclude=temp") |
| 29 | + if flake8_status != 0: |
| 30 | + print("\nWARNING! Fix flake8 issues before publishing to PyPI!\n") |
| 31 | + sys.exit() |
| 32 | + else: |
| 33 | + print("*** No flake8 issues detected. Continuing...") |
| 34 | + print("\n*** Rebuilding distribution packages: ***\n") |
| 35 | + os.system('rm -f dist/*.egg; rm -f dist/*.tar.gz; rm -f dist/*.whl') |
| 36 | + os.system('python setup.py sdist bdist_wheel') # Create new tar/wheel |
| 37 | + print("\n*** Installing twine: *** (Required for PyPI uploads)\n") |
| 38 | + os.system("python -m pip install 'twine>=1.14.0'") |
| 39 | + print("\n*** Publishing The Release to PyPI: ***\n") |
| 40 | + os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys |
| 41 | + print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n") |
| 42 | + else: |
| 43 | + print("\n>>> The Release was NOT PUBLISHED to PyPI! <<<\n") |
| 44 | + sys.exit() |
| 45 | + |
18 | 46 | setup(
|
19 | 47 | name='seleniumbase',
|
20 | 48 | version='1.31.5',
|
|
0 commit comments