nice-florist-55958
11/14/2021, 8:50 PM3rdpary/pkg/bin.so , Pants only copies the *.py files when running the test goal. So import pkg results in __init__.py being invoked and then an import error from from .bin import * because bin.so is not in the sandboxed environment. Confirmed by dropping into pdb and looking at the folder structure in the execution env.
Any ideas? Is that expected behavior or?enough-analyst-54434
11/14/2021, 9:02 PMenough-analyst-54434
11/14/2021, 9:03 PMenough-analyst-54434
11/14/2021, 9:09 PMpython_sources, that only globs (small lie) *.py by default; so you'll manually need to specify sources globs: https://www.pantsbuild.org/v2.8/docs/reference-python_sourcesnice-florist-55958
11/14/2021, 9:17 PMsources=['*.py', '*.so', etc.] ?enough-analyst-54434
11/14/2021, 9:18 PMtailor goal for automating basic BUILD target seeding?enough-analyst-54434
11/14/2021, 9:18 PMnice-florist-55958
11/14/2021, 9:33 PMnice-florist-55958
11/14/2021, 9:35 PMpython_sources(description="fidlib", sources=["*.py", "*.so"]) ; when I drop into the debugger I only see __init__.py and __pycache__ ; the binary fidbin.so is missing. I tried explicitly listing it as well, no luck.nice-florist-55958
11/14/2021, 9:38 PMsources field: "3rdparty/fidlib/*.so"`
But if I grep the exact directory it's complaining with .so I see the file...nice-florist-55958
11/14/2021, 9:40 PM*.so is a pattern in our .gitignoreenough-analyst-54434
11/14/2021, 9:43 PMnice-florist-55958
11/14/2021, 9:43 PM[ERROR] The 'sources' field in target 3rdparty/fidlib:fidlib can only contain files that end in one of ['', '.py', .pyi'] but it had these files: ['3rdparty/fidlib/fidbin.so']enough-analyst-54434
11/14/2021, 9:43 PMnice-florist-55958
11/14/2021, 9:46 PMenough-analyst-54434
11/14/2021, 9:46 PMnice-florist-55958
11/14/2021, 9:51 PMhundreds-father-404
11/15/2021, 4:39 PMI see the logic of that given this is more of a resource than a source file(Indeed, Idea being that you cannot do things like run Black or Flake8 on the
.so file. It's not a Python file, only a resource understood by Python)enough-analyst-54434
11/15/2021, 5:26 PM