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

run.py depends on cat, why? #758

Closed
hallvors opened this issue Oct 10, 2015 · 4 comments
Closed

run.py depends on cat, why? #758

hallvors opened this issue Oct 10, 2015 · 4 comments
Assignees

Comments

@hallvors
Copy link
Contributor

Trying to run run.py on Windows fails because it tries to call the cat command on line 63:

req = subprocess.check_output(["cat", "requirements.txt"]).splitlines()

The easiest workaround is to do run.py -t to launch "test mode", and I guess we'll never ever run this on a system where 'cat' is not available for production. But why depend on cat in the first place?

for req in open("requirements.txt"):
    pkg_resources.require(req)

should do, I think.

@karlcow
Copy link
Member

karlcow commented Oct 11, 2015

@hallvors is talking about

webcompat.com/run.py

Lines 57 to 71 in 2936db3

def check_pip_deps():
'''Check installed pip dependencies.
Make sure that the installed pip packages match what is in
requirements.txt, prompting the user to upgrade if not.
'''
req = subprocess.check_output(["cat", "requirements.txt"]).splitlines()
try:
pkg_resources.require(req)
except VersionConflict as e:
print(DEPS_VERSION_HELP % e)
except DistributionNotFound as e:
print(DEPS_NOTFOUND_HELP % e)
else:
return True

@karlcow
Copy link
Member

karlcow commented Oct 11, 2015

That was my commit 7252891

And yes good comment. Your proposal is a good one. Also possible.

try:
   pkg_resources.require([req for req in open("requirements.txt")])

@hallvors
Copy link
Contributor Author

Wow, even more brief :)

@miketaylr
Copy link
Member

Cool, learned some more Python today. ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants