-
Notifications
You must be signed in to change notification settings - Fork 40
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
feat: python plugin file listing #943
feat: python plugin file listing #943
Conversation
@@ -73,3 +77,38 @@ def _get_package_install_commands(self) -> list[str]: | |||
) | |||
|
|||
return commands | |||
|
|||
@override | |||
def get_files(self) -> PackageFiles: |
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'll bet we can put this in the base Python plugin. In all three cases they generate PEP 405 compatible virtual environments in self._get_venv_directory()
. (I'm fine if you don't do so in this PR, but when we get to the point of implementing it for poetry and uv it probably comes roughly for free)
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.
thanks!
# over time. And we can't assert the number of keys because py3.10 installs | ||
# setuptools as a separate package. | ||
print(actual_file_list.keys()) | ||
for expected_pkg in { |
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.
won't this fail as soon as a new version of any of these packages comes out?
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.
sheesh @mattculler sorry for the noise, I guess Alex and I were reviewing this at the same time and ended up pointing out the same things |
No worries, it's actually really impressive how similar your reviews were. |
pkgs_install_dir.mkdir(parents=True) | ||
bins_dir.mkdir() | ||
|
||
(bins_dir / "doit").touch() |
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.
This is better but I was thinking you could add the actual file tree, with fakeee
directory and fakeee/a_file.py
file and so on, to a git-committed dir
like the integration tests do, but there's nothing restricting that to integration tests: https://github.com/canonical/craft-parts/tree/main/tests/integration/plugins/test_python
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.
Ok will do
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.
for found_pkg in actual_file_list: | ||
# Check a few specifics to make sure we got package contents correctly | ||
if found_pkg.name == "Jinja2": | ||
assert len(actual_file_list[found_pkg]) == 57 |
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 can't know this for anything where we're not asserting a specific package. We can probably presume it to be a nonzero number, but the only one we can have any real confidence in is flask.
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.
Dammit, good point.
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.
Co-authored-by: Alex Lowe <[email protected]>
Co-authored-by: Alex Lowe <[email protected]>
…f files Also fix syntax error from GH PR suggestion.
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.
LGTM! Adding @mr-cal for final review as the project owner
docs/reference/changelog.rst
)?Implement origin package -> file mapping for the python plugin, to be used in xattr tagging.
(CRAFT-3758)