Skip to content

Commit

Permalink
replaced script with entry point in setup.py
Browse files Browse the repository at this point in the history
The `setup.py` specified previously a script which caused problems when
running pyicontract-lint on Windows (*e.g.*, Windows could not find the
interpreter since the shebang is ignored). This change removes the
script and specifies an entry point in `setup.py` so that the executable
is correctly created on Windows upon installation.

See also:
https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-creation
  • Loading branch information
mristin committed Aug 22, 2020
1 parent 465eb7c commit d99e523
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
7 changes: 0 additions & 7 deletions bin/pyicontract-lint

This file was deleted.

4 changes: 2 additions & 2 deletions icontract_lint/main.py
Expand Up @@ -60,7 +60,7 @@ def _main(args: Args, stream: TextIO) -> int:
return 0


def main() -> None:
def main() -> int:
"""Wrap the main routine so that it can be tested."""
args = parse_args(sys_argv=sys.argv)
sys.exit(_main(args=args, stream=sys.stdout))
return _main(args=args, stream=sys.stdout)
12 changes: 6 additions & 6 deletions precommit.py
Expand Up @@ -28,26 +28,26 @@ def main() -> int:
if overwrite:
subprocess.check_call(
[
"yapf", "--in-place", "--style=style.yapf", "--recursive", "tests", "icontract_lint",
"bin/pyicontract-lint", "setup.py", "precommit.py"
"yapf", "--in-place", "--style=style.yapf", "--recursive", "tests", "icontract_lint", "setup.py",
"precommit.py"
],
cwd=repo_root.as_posix())
else:
subprocess.check_call(
[
"yapf", "--diff", "--style=style.yapf", "--recursive", "tests", "icontract_lint",
"bin/pyicontract-lint", "setup.py", "precommit.py"
"yapf", "--diff", "--style=style.yapf", "--recursive", "tests", "icontract_lint", "setup.py",
"precommit.py"
],
cwd=repo_root.as_posix())

print("Mypy'ing...")
subprocess.check_call(["mypy", "icontract_lint", "bin/pyicontract-lint", "tests"], cwd=repo_root.as_posix())
subprocess.check_call(["mypy", "icontract_lint", "tests"], cwd=repo_root.as_posix())

print("Pylint'ing...")
subprocess.check_call(["pylint", "--rcfile=pylint.rc", "tests", "icontract_lint"], cwd=repo_root.as_posix())

print("Pydocstyle'ing...")
subprocess.check_call(["pydocstyle", "icontract_lint", "bin/pyicontract-lint"], cwd=repo_root.as_posix())
subprocess.check_call(["pydocstyle", "icontract_lint"], cwd=repo_root.as_posix())

print("Testing...")
env = os.environ.copy()
Expand Down
8 changes: 5 additions & 3 deletions setup.py
Expand Up @@ -31,7 +31,9 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
'Programming Language :: Python :: 3.6',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX'
# yapf: enable
],
license='License :: OSI Approved :: MIT License',
Expand All @@ -42,7 +44,7 @@
'dev': [
# yapf: disable
'mypy==0.620',
'pylint==2.1.1',
'pylint==2.3.0',
'yapf==0.20.2',
'tox>=3.0.0',
'pydocstyle>=2.1.1,<3',
Expand All @@ -51,7 +53,7 @@
# yapf: enable
],
},
scripts=['bin/pyicontract-lint'],
entry_points={"console_scripts": ["pyicontract-lint = icontract_lint.main:main"]},
py_modules=['icontract_lint', 'pyicontract_lint_meta'],
include_package_data=True,
package_data={
Expand Down

0 comments on commit d99e523

Please sign in to comment.