-
Notifications
You must be signed in to change notification settings - Fork 24
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
A new test for file existence inside a package (for the new recipe format) #57
Conversation
```yaml | ||
package_contents: | ||
# checks for the existence of files inside $PREFIX or %PREFIX% | ||
files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
files: | |
prefix: |
Given that the rest of the categories use the "base location" as key name, this might make more sense.
# checks for the existence of `mamba/api/__init__.py` inside of the Python site-packages directory | ||
# NOTE: the user can/should also use Python import checks | ||
site_packages: | ||
- mamba.api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that we can have direct access to site_packages
, but I am not sure about the Python import path syntax. How can I make sure I have a data file in my Python package, for example? I'd say we stick to normal paths here, so this would be written like this:
- mamba.api | |
- mamba/api/__init__.py |
After all, we have the imports:
tests anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's a good point.
|
||
# searches for `$PREFIX/lib/libmamba.so` or `$PREFIX/lib/libmamba.dylib` on Linux or macOS, | ||
# on Windows for %PREFIX%\Library\lib\mamba.dll & %PREFIX%\Library\bin\mamba.bin | ||
lib: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about versioned libraries? The numbered suffixes are placed in different spots of the filename in linux and macos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check what CMake is doing (they also have some "find_library" heuristic).
I also think it would be nice if one can add the version number, e.g. libmamba.0
(and it would find either libmamba.so.0
or libmamba.0.dylib
but that would require some more logic in the string parsing (or we make it more explicit).
I like this a lot! Left a few comments. I am also wondering how we can test that some files were not added. It is common to have package_contents:
files:
- ~tests # or "!tests" |
Great point! I think exclamation mark doesn't work in YAML, but tilde is fine. |
Co-authored-by: jaimergp <[email protected]>
Are there other special locations, e.g. for R packages? |
Maybe: package_contents:
includes:
- mamba/api/
excludes:
- mamba/tests/ |
@dhirschfeld that is also nice, but then it becomes harder to negate the existence of a given shared library, include file, etc. I lean towards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense. Though, I'm wondering if it would be a god occasion to introduce a strict mode where the recipe has to define strictly which files should be included in the package similar to how it's done in the RPM land (https://src.fedoraproject.org/rpms/yaml-cpp/blob/rawhide/f/yaml-cpp.spec#_72). package_contents
really makes me think of that.
Though, I'm not sure if it's really related to your PR or if we should have this discussion somewhere else.
## The specification | ||
|
||
We propose a new "test" section (following the split of testing sections in this [CEP](https://github.com/conda-incubator/ceps/pull/56)) to test for package file existence. | ||
The test are executed on the raw package contents (without installing them). That should make them very fast to execute, as well as less brittle vs. cmd.exe / bash scripts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "without installing them" mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means that the tests only require the paths.json
file. The package does not need to be extracted or linked into an environment.
@JeanChristopheMorinPerso the RPM spec that you linked also has this:
So it seems that it similarly has a "glob" syntax to take an entire directory. But thanks for the pointer, I didn't know about that! |
Some things that came up yesterday in the mamba meeting:
@JeanChristopheMorinPerso now that I think about it it could be a great idea to have a |
Maybe |
In an ideal world, this would also check that the |
@h-vetinari I just chatted with ChatGPT and looks like we can do that with Goblin and some inspection of the files. |
They support a glob-style match, but I don't know if |
Closing in favor of #84. |
No description provided.