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

feat: Let mesa runserver detect server.py as fallback #2015

Merged
merged 1 commit into from
Feb 4, 2024
Merged
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
13 changes: 8 additions & 5 deletions mesa/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
PROJECT is the path to the directory containing `run.py`, or the current
directory if not specified.
"""
run_path = Path(project) / "run.py"
if not run_path.exists():
sys.exit(f"ERROR: file {run_path} does not exist")
args = [sys.executable, str(run_path)]
call(args)
run_files = ["run.py", "server.py"]

Check warning on line 33 in mesa/main.py

View check run for this annotation

Codecov / codecov/patch

mesa/main.py#L33

Added line #L33 was not covered by tests
for run_file in run_files:
run_path = Path(project) / run_file

Check warning on line 35 in mesa/main.py

View check run for this annotation

Codecov / codecov/patch

mesa/main.py#L35

Added line #L35 was not covered by tests
if not run_path.exists():
continue
args = [sys.executable, str(run_path)]
call(args)
sys.exit(f"ERROR: file run.py or server.py (in {Path(project)}) does not exist")

Check warning on line 40 in mesa/main.py

View check run for this annotation

Codecov / codecov/patch

mesa/main.py#L37-L40

Added lines #L37 - L40 were not covered by tests


@click.command()
Expand Down