Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not build tables if
egg_info
is passed to setup.py
This allows `pip` to collect the dependency graph when installing from a `requirements.txt`. The dependency issue is as follows. Requiring development versions inside `setup.py` is fine, since that defines a requirement. But relaxing security (--allow-external and the like) inside `setup.py` is implicit (because it is placed at an unexpected location), can cause surprises, and describes how to fetch a particular version (so it is imperative, instead of declarative). By convention, the “how to” fetch the required development versions should be placed in `requirements.txt` (explicit is better). In case of building first with `ply`, a race condition arises. When `pip` installs from `requirements.txt`, it first fetches all packages, then uses topological order in the dependency graph to install them. This approach is correct, because topological order requires to first collect everything. But to collect information (w/o installing) a package, `pip` has to run `setup.py`. As a result, if `setup.py` tries to build `ply` tables, it fails. The failure occurs during import of the parser's module, caused by an absent dependency. The dependency failed to be installed by the call to `pip` by `setup.py`, because that call does not include sufficient information and options to enable/allow `pip` to fetch the development version of that dependency. The workaround is to detect the `egg_info` option that `pip` always passes to packages [1], in order to collect their information to build the dependency graph, before installing. [1] https://github.com/pypa/pip/blob/bc5bb70e6004de5312f5d04d8d0374b3615a2e70/pip/req/req_install.py#L399
- Loading branch information