Skip to content

dev_tools/modules.py print_version fails with an error #5701

@mhucka

Description

@mhucka

Description of the issue

This report is a follow-up to a comment by @vtomole on PR #5637. The current version of dev_tools/modules.py exits with an error if given the argument print_version (which is one of arguments it is supposed to accept).

How to reproduce the issue

In a shell, with the current directory being the top level of the Cirq source code repo cloned from GitHub, run the following command:

python dev_tools/modules.py print_version
Failed to run ./setup.py:
Traceback (most recent call last):
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 317, in <module>
    main(sys.argv[1:])  # coverage: ignore
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 313, in main
    f(**vars(args))
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 216, in _print_version
    print(get_version())
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 135, in get_version
    mods = list_modules(search_dir=search_dir, include_parent=True)
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 112, in list_modules
    result = [
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 113, in <listcomp>
    Module(root=folder, raw_setup=_parse_module(search_dir / folder))
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 194, in _parse_module
    exec(setup_py, globals(), {})
  File "<string>", line 22, in <module>
ModuleNotFoundError: No module named 'dev_tools'

Cirq version

0.16.0.dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug-reportSomething doesn't seem to work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions