Skip to content

Commit

Permalink
move mypyc to console_scripts (python#11494)
Browse files Browse the repository at this point in the history
Description
See mypyc/mypyc#893
  • Loading branch information
imba-tjd authored and tushar-deepsource committed Jan 20, 2022
1 parent 384e62f commit e7f698a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
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

0 comments on commit e7f698a

Please sign in to comment.