/usr/lib/python3/dist-packages/requirements_detector/run.py is in python3-requirements-detector 0.4.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import os
import sys
from requirements_detector.detect import RequirementsNotFound
from requirements_detector.formatters import FORMATTERS
from requirements_detector import find_requirements
def _die(message):
sys.stderr.write("%s\n" % message)
sys.exit(1)
def run():
if len(sys.argv) > 1:
path = sys.argv[1]
else:
path = os.getcwd()
if not os.path.exists(path):
_die("%s does not exist" % path)
if not os.path.isdir(path):
_die("%s is not a directory" % path)
try:
requirements = find_requirements(path)
except RequirementsNotFound:
_die("Unable to find requirements at %s" % path)
format_name = 'requirements_file' # TODO: other output formats such as JSON
FORMATTERS[format_name](requirements)
sys.exit(0)
if __name__ == '__main__':
run()
|