mottosso / bleeding-rez

Rez - Reproducible software environments for Windows, Linux and MacOS
GNU Lesser General Public License v3.0
72 stars 10 forks source link

Support for ANY-package #37

Open mottosso opened 5 years ago

mottosso commented 5 years ago

Goal

Support requirements that depend not not on only a range of different versions, but also a range of different packages.

Motivation

Useful for e.g. Qt.py which requires [pyside, pyside2, pyqt4 or pyqt5], and for packages that depend on either [bleeding_rez, rez]. It can't depend on all, and it can't depend on none.

However, it dawned on me that this can also solve https://github.com/nerdvegas/rez/issues/21 which would be great, and could potentially squat two flies with one stone.

Implementation

From command-line.

rez env six python [pyqt4 pyqt5]

From your package.py

requires = [
  "pyyaml-2.4",
  "six-1.1",
  ["PySide-1.2, "PyQt4-4.7", "PyQt5", "PySide2"],
]

Where the first package found is picked.

As an added bonus, we'll also (finally) be able to account for https://github.com/nerdvegas/rez/issues/21 by adding a null package that does nothing.

requires = [
  ["", "packageA-1.2"]
]

Now both "packageA-1.2" and "" are equally acceptable. If packageA-1.2 isn't found, it would behave as though it was optional and not break the solve.

mottosso commented 5 years ago
mottosso commented 5 years ago

Possible command-line syntax for both optional and ANY-style requests.

rez env Qt.py (PySide2 PySide) pillow (numpy)