lumicks / embedded_python

Conan package which generates a Python distribution for embedding
Apache License 2.0
4 stars 0 forks source link

Support passing full `requirements.txt` to the `packages` option #7

Closed dean0x7d closed 3 years ago

dean0x7d commented 3 years ago

So far, embedded_python:packages required that the user passes a space-separated list of packages, just like one would to pip install <packages>. This PR enables users to pass a full requirements.txt file verbatim, similar to pip install -r <file>. But note that embedded_python:packages expects the contents of a requirements.txt file, not the path to the file.

The full requirements.txt format supports markers. They allow conditionally depending on packages based on a platform or Python version. For example, the following line in a requirements.txt file will only install the dependency on Windows:

pywin32==300; sys_platform == "win32"

This is a crucial feature to enable multi-platform support.

As a nice extra benefit, this simplifies how we pass the packages specification to Conan. We no longer need .split(“\n”). See the test package for example.

This PR makes a couple of robustness improvements along the way. Please review per-commit.