Skip to content

Commit

Permalink
Fix entry point for packaging
Browse files Browse the repository at this point in the history
Python scripts packaging expects a parameter-less entry point.
  • Loading branch information
agrenott committed Nov 6, 2023
1 parent 43b0f63 commit ba710a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pythonpackage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ jobs:
hatch run geotiff:all
- name: Run unit test without Geotiff dependencies
run: |
hatch run test
hatch run test
- name: Ensure script entrypoint is executable
run: |
hatch run pyhgtmap -v
- name: Report test-coverage to DeepSource
# Deepsource doesn't seem super stable
continue-on-error: true
Expand Down
10 changes: 8 additions & 2 deletions pyhgtmap/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def parseCommandLine(sys_args: List[str]) -> Tuple[Values, List[str]]:
return opts, args


def main(sys_args: List[str]) -> None:
def main_internal(sys_args: List[str]) -> None:
opts, args = parseCommandLine(sys_args)
configure_logging(opts.logLevel)

Expand Down Expand Up @@ -589,5 +589,11 @@ def main(sys_args: List[str]) -> None:
)


def main() -> None:
"""Parameter-less entry point, required for python packaging scripts"""
# https://packaging.python.org/en/latest/specifications/entry-points/#use-for-scripts
main_internal(sys.argv[1:])


if __name__ == "__main__":
main(sys.argv[1:])
main()

0 comments on commit ba710a7

Please sign in to comment.