Python: Conditional dependencies (environment markers)
Tim Diels <[email protected]> Sat, 4 Mar 2017 15:04:01 +0100
| Newsgroups | gmane.comp.file-systems.zero-install.devel |
|---|---|
| Message-ID | <CAMjmSuRA0mM=OPZMJDj6jaG3OoROt6QwBSt5uB2ZqW4v1Fb-Gw@mail.gmail.com> |
Dear all,
Could support be added for conditional dependencies as available in Python
packages? See https://www.python.org/dev/peps/pep-0508/#environment-markers
for how it works in Python. I need this to convert Python packages with
conditional dependencies to Zero Install feeds. It's not necessary to
follow the spec exactly, just so long as I can convert to it.
If you are open to adding this feature to ZI, consider the initial design
below. I would love to hear about better approaches/naming for supporting
conditional dependencies. The design should be extensible as more special
cases will likely arise when converting other package types (e.g. conda) in
the future.
First, I would make the following interfaces:
- cpython.xml: CPython
- jython.xml: Jython
- ...
- python.xml: any python. This includes cpython.xml, jython.xml, ...
Then for python_version, python_full_version,
platform_python_implementation. I would convert to:
<if selected='jython.xml' version='{constraint}'>
<requires ...>
platform_machine could perhaps be expressed as:
<if arch={converted_platform_machine}>
<requires ...>
where arch refers to the arch of the actual system, not the implementation.
E.g. its value is never '*-*', always something concrete.
sys_platform (e.g. java1.8.0_51) could be handled like:
<if selected='java.xml' version='1.8.0_51'>
<requires ...>
Something more special would be required for platform_version as its value
depends on the runtime environment (number of cores, which kernel, ...):
<if python:platform-version=...>
Or instead of trying to generalise, we could add each environment marker
variable as `<if python:{environment_variable_name} >`; but likely there is
interest for conditional dependencies in other languages as well.
I look forward to hearing your suggestions.
Cheers,
Tim
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Zero-install-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/zero-install-devel