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
Move csrgen templates into ipaclient package #534
Conversation
@LiptonB please have a look. |
csrgen broke packaging of ipaclient for PyPI. All csrgen related resources are now package data of ipaclient package. Package data is accessed with Jinja's PackageLoader() or through pkg_resources. https://pagure.io/freeipa/issue/6714 Signed-off-by: Christian Heimes <cheimes@redhat.com>
@@ -56,5 +63,6 @@ | |||
extras_require={ | |||
"install": ["ipaplatform"], | |||
"otptoken_yubikey": ["yubico", "usb"] | |||
} | |||
}, | |||
zip_safe=False, |
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.
Is this needed? According to http://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag "And if the project uses pkg_resources for all its data file access, then C extensions and other data files shouldn’t be a problem at all." zip_safe=true
seems to work when I build it locally, but I'm not sure if I'm testing it properly.
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.
Ah, Jinja uses a pkg_resources ResourceManager to access files. So in theory, zip loading would work.
In practice the option and feature is longer relevant. Python eggs are a dying species and Python wheels no longer use zip deployment.
Oops, sorry about the breakage. This seems fine to me, although I hadn't really been thinking of the templates and rules as data files. They're intended to be possible to modify, more like config files. (Come to think of it, |
In my opinion, a user should never modify a file that managed by a package manager and not explicitly marked as a config file. Both files in How about http://jinja.pocoo.org/docs/2.9/api/#jinja2.ChoiceLoader and this idea?
This allows users to override the templates by copying them to |
First try custom location, then csrgen subdir in confdir and finally fall back to package data. Signed-off-by: Christian Heimes <cheimes@redhat.com>
I think this is a much better way to make it configurable than how I had it, and the implementation looks good to me. Thanks! |
csrgen broke packaging of ipaclient for PyPI. All csrgen related
resources are now package data of ipaclient package. Package data is
accessed with Jinja's PackageLoader() or through pkg_resources.
https://pagure.io/freeipa/issue/6714
Signed-off-by: Christian Heimes cheimes@redhat.com