Browse Source

Blacken'd

master
blallo 3 years ago
parent
commit
589d95b5ac
Signed by: blallo GPG Key ID: 0CBE577C9B72DC3F
  1. 3
      bot_z/cli.py
  2. 26
      setup.py
  3. 6
      tests/test_bot_z.py

3
bot_z/cli.py

@ -8,8 +8,7 @@ import click
@click.command()
def main(args=None):
"""Console script for bot_z."""
click.echo("Replace this message by putting your code into "
"bot_z.cli.main")
click.echo("Replace this message by putting your code into " "bot_z.cli.main")
click.echo("See click documentation at http://click.pocoo.org/")

26
setup.py

@ -21,11 +21,11 @@ import zipfile
GECKO_RELEASE_PATH = "https://github.com/mozilla/geckodriver"
PKG_NAME = 'bot_z'
VERSION = '0.1.0'
AUTHOR = 'blallo'
AUTHOR_EMAIL = 'blallo@autistici.org'
BIN_PATH = 'bin/geckodriver'
PKG_NAME = "bot_z"
VERSION = "0.1.0"
AUTHOR = "blallo"
AUTHOR_EMAIL = "blallo@autistici.org"
BIN_PATH = "bin/geckodriver"
with open("README.md") as readme_file:
readme = readme_file.read()
@ -151,15 +151,15 @@ def download_driver_bin(uri: str, path: str) -> None:
os.remove(filepath)
def preinstall(platform: T.Optional[str]=None) -> None:
def preinstall(platform: T.Optional[str] = None) -> None:
"""
Performs all the postintallation flow, donwloading in the
right place the geckodriver binary.
"""
# target_path = os.path.join(os.path.abspath(os.path.curdir), 'bot_z', 'bin')
target_path = pkg_resources.resource_filename('bot_z', 'bin')
target_path = pkg_resources.resource_filename("bot_z", "bin")
ensure_local_folder()
version = os.environ.get('BOTZ_GECKO_VERSION')
version = os.environ.get("BOTZ_GECKO_VERSION")
gecko_uri = assemble_driver_uri(version, platform)
print("[POSTINSTALL] gecko_uri: {}".format(gecko_uri))
download_driver_bin(gecko_uri, target_path)
@ -203,7 +203,7 @@ class CustomInstallCommand(install):
def run(self):
opts = self.distribution.get_cmdline_options()
platform = None
if 'bdist_wheel' in opts:
if "bdist_wheel" in opts:
platform = translate_platform_to_gecko_vers(
opts["bdist_wheel"].get("plat-name")
)
@ -242,12 +242,8 @@ setup(
"install": CustomInstallCommand,
"bdist_wheel": CustomBDistWheel,
},
entry_points={
'console_scripts': [
'bot_z=bot_z.cli:main'
]
},
package_data = {'bot_z': ['bin/geckodriver']},
entry_points={"console_scripts": ["bot_z=bot_z.cli:main"]},
package_data={"bot_z": ["bin/geckodriver"]},
include_package_data=True,
install_requires=requirements,
license="GLWTS Public Licence",

6
tests/test_bot_z.py

@ -28,7 +28,7 @@ class TestBot_z(unittest.TestCase):
runner = CliRunner()
result = runner.invoke(cli.main)
assert result.exit_code == 0
assert 'bot_z.cli.main' in result.output
help_result = runner.invoke(cli.main, ['--help'])
assert "bot_z.cli.main" in result.output
help_result = runner.invoke(cli.main, ["--help"])
assert help_result.exit_code == 0
assert '--help Show this message and exit.' in help_result.output
assert "--help Show this message and exit." in help_result.output

Loading…
Cancel
Save