Skip to content

Commit

Permalink
Merge pull request #48 from jaraco/feature/read-deps-check
Browse files Browse the repository at this point in the history
Ensure read-deps errors when the specified script does not exist.
  • Loading branch information
jaraco authored Jan 29, 2021
2 parents 6eadf99 + 99320d8 commit e947802
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v8.3.0
======

#47: ``read_deps`` now errors on non-existent files.

v8.2.1
======

Expand Down
16 changes: 8 additions & 8 deletions pip_run/read-deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
Emit parameters to pip extracted from a script.
"""

import sys
import autocommand
import path

from .scripts import DepsReader


def run(args=None):
@autocommand.autocommand(__name__)
def run(script: path.ExtantFile):
"""
>>> run(['examples/test-mongodb-covered-query.py'])
pytest jaraco.mongodb>=3.10
>>> run(['does-not-exist'])
Traceback (most recent call last):
FileNotFoundError: does-not-exist does not exist as a file.
"""
(script,) = args or sys.argv[1:]
deps = DepsReader.try_read(script)
print(' '.join(deps.params()))


__name__ == '__main__' and run()
print(' '.join(DepsReader.try_read(script).params()))
5 changes: 4 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ packages = find_namespace:
include_package_data = true
py_modules = pip-run
python_requires = >=3.6
install_requires = pip >= 19.3
install_requires =
pip >= 19.3
autocommand
path >= 15.1
setup_requires = setuptools_scm[toml] >= 3.4.1

[options.packages.find]
Expand Down

0 comments on commit e947802

Please sign in to comment.