I could use some ideas on how to deal with this sy...
# general
p
I could use some ideas on how to deal with this symlink: https://github.com/st2sandbox/st2/blob/pants/st2tests/st2tests/fixtures/packs/core which links to: https://github.com/st2sandbox/st2/tree/pants/contrib/core I'm going to talk about the two distribution paths, to help with understanding why other people added the symlink, but I'm not asking about distribution/archives/etc.
contrib/core
primarily has files+code (in a StackStorm pack) that gets installed with StackStorm itself. But, it is also distributed as part of the
st2tests
module which provides general purpose test fixtures for use in the StackStorm ecosystem. There are a couple of issues with the symlink. The first of which was disambiguating a dependency which was simple enough: https://github.com/st2sandbox/st2/blob/pants/contrib/core/tests/BUILD#L3 The next couple of issues are intertwined: • For all the other fixtures, I used a python import so that pants could infer the dependency from test to fixture. But that get's a little odd with the symlinked code living in two places. •
contrib/core
is a source root (identified by a
[source].marker_filenames
file), but
st2tests/fixtures/packs/core
should not be a source root. Please help me think through what to do about this. I'm not even sure what questions to ask. Any thoughts?
h
Hmmm
Need to ponder this
👍 1
How many source roots do you have, total? Wondering if you could enumerate them in the source root config, instead of using marker files
1
p
I had a regex, but a core contributor for ST2 didn’t like that. Then I used
pack.yaml
as a marker file, which conflicted with how I had to load the fixtures. Now I’ve got a more limited set of files with an empty
PACK_ROOT
file. There are 7 (maybe 9) of those, so I guess I’ll just have to list them.
That’s 7 in addition to another 9 patterns already in my pants.toml file
h
Not sure this will help though - there is always a source root. Pants takes the innermost dir that looks like one based on the source_roots config. So if all else fails it'll treat the repo root like a source root for
st2tests/fixtures/packs/core
Which is presumably not what you want
Well, although, the import problem will be solved since the import path won't be the same relative to the source root
So actually this probably will help
p
Hmm. OK I think that resolves it. Thanks. Here's my big long explanation of why for future people that want to simplify: https://github.com/st2sandbox/st2/blob/pants/pants.toml#L40-L71
h
Thanks for the explanation!