Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move mypyc to console_scripts #11494

Merged
merged 7 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/mypyc → mypyc/__main__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Mypyc command-line tool.

Usage:
Expand Down Expand Up @@ -27,6 +26,7 @@
)
"""


def main() -> None:
build_dir = 'build' # can this be overridden??
try:
Expand All @@ -49,5 +49,6 @@ def main() -> None:
cmd = subprocess.run([sys.executable, setup_file, 'build_ext', '--inplace'], env=env)
sys.exit(cmd.returncode)


if __name__ == '__main__':
main()
4 changes: 2 additions & 2 deletions mypyc/doc/dev-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ compiled code. For example, you may want to do interactive testing or
to run benchmarks. This is also handy if you want to inspect the
generated C code (see Inspecting Generated C).

Run `scripts/mypyc` to compile a module to a C extension using your
Run `mypyc` to compile a module to a C extension using your
development version of mypyc:

```
$ scripts/mypyc program.py
$ mypyc program.py
```

This will generate a C extension for `program` in the current working
Expand Down
3 changes: 1 addition & 2 deletions mypyc/test/test_commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
out = b''
try:
# Compile program
cmd = subprocess.run([sys.executable,
os.path.join(base_path, 'scripts', 'mypyc')] + args,
cmd = subprocess.run([sys.executable, '-m', 'mypyc', *args],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='tmp')
if 'ErrorOutput' in testcase.name or cmd.returncode != 0:
out += cmd.stdout
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ def run(self):
ext_modules=ext_modules,
packages=find_packages(),
package_data={'mypy': package_data},
scripts=['scripts/mypyc'],
entry_points={'console_scripts': ['mypy=mypy.__main__:console_entry',
'stubgen=mypy.stubgen:main',
'stubtest=mypy.stubtest:main',
'dmypy=mypy.dmypy.client:console_entry',
'mypyc=mypyc.__main__:main',
]},
classifiers=classifiers,
cmdclass=cmdclass,
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ description = type check ourselves
basepython = python3.7
commands =
python -m mypy --config-file mypy_self_check.ini -p mypy -p mypyc
python -m mypy --config-file mypy_self_check.ini misc/proper_plugin.py scripts/mypyc
python -m mypy --config-file mypy_self_check.ini misc/proper_plugin.py

[testenv:docs]
description = invoke sphinx-build to build the HTML docs
Expand Down