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

req_files only work when files is included in data attributes #43

Open
mouadino opened this issue Sep 17, 2017 · 1 comment
Open

req_files only work when files is included in data attributes #43

mouadino opened this issue Sep 17, 2017 · 1 comment

Comments

@mouadino
Copy link
Contributor

mouadino commented Sep 17, 2017

Tried this

filegroup(
    name = "requirements",
    srcs = [
        "requirements.txt",
    ],
)

pex_pytest(
    name = "default_test",
    srcs = glob(["**/*.py"]),
    deps = [
        ":default_library",
    ],
    req_files = [
       ":requirements",
    ],
)

And it fails with

  File "/Users/mouad/.cache/bazel/_bazel_mouad/bazel-sandbox/8258116086626091877/execroot/__main__/.pex/install/pex_wrapper-0.1-py2-none-any.whl.213146efb1c3b3423224a6d8dabeba348a129f7e/pex_wrapper-0.1-py2-none-any.whl/pex_wrapper.py", line 131, in <module>
    main()
  File "/Users/mouad/.cache/bazel/_bazel_mouad/bazel-sandbox/8258116086626091877/execroot/__main__/.pex/install/pex_wrapper-0.1-py2-none-any.whl.213146efb1c3b3423224a6d8dabeba348a129f7e/pex_wrapper-0.1-py2-none-any.whl/pex_wrapper.py", line 85, in main
    resolver_options_builder)
  File "/Users/mouad/.cache/bazel/_bazel_mouad/bazel-sandbox/8258116086626091877/execroot/__main__/.pex/install/pex-1.2.9-py2.py3-none-any.whl.5c6ee6196c29e6a1d0cc5e5b4d54bb3369c2b93f/pex-1.2.9-py2.py3-none-any.whl/pex/bin/pex.py", line 528, in build_pex
    resolvables.extend(requirements_from_file(requirements_txt, resolver_option_builder))
  File "/Users/mouad/.cache/bazel/_bazel_mouad/bazel-sandbox/8258116086626091877/execroot/__main__/.pex/install/pex-1.2.9-py2.py3-none-any.whl.5c6ee6196c29e6a1d0cc5e5b4d54bb3369c2b93f/pex-1.2.9-py2.py3-none-any.whl/pex/requirements.py", line 97, in requirements_from_file
    with open(filename, 'r') as fp:
IOError: [Errno 2] No such file or directory: 'services/delivery/requirements.txt'

After a bit of debugging, I found out that my requirements.txt is not actually in the folder /Users/mouad/.cache/bazel/_bazel_mouad/execroot/__main__/services/delivery, but then when I changed the target to:

pex_pytest(
    name = "default_test",
    srcs = glob(["**/*.py"]),
    deps = [
        ":default_library",
    ],
    req_files = [
       ":requirements",
    ],
    data = [
       ":requirements",
    ],
)

It worked!

Is this by design or I am missing something?

@benley
Copy link
Owner

benley commented Sep 18, 2017

You have probably found a bug! I think this will be fairly easy to fix.

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

2 participants