zc.buildout 3.0.1+slapos001: Rebase on zc.buildout 3.0.1
zc.buildout 3.0.1+slapos001
Rebase, adapt and rework our patches on zc.buildout 3.0.1
This brings in pip-powered support for pyproject.toml specifications which are taking over legacy setup.py.
This is the central piece of a multi-MR work:
-
slapos.rebootstrap!4 (merged) - Adapt slapos.rebootstrap to
zc.buildout 3.0.1+slapos001 - slapos.rebootstrap!5 (merged) - Adapt rebootstrap to setuptools >= 52.0.0 without easy_install
-
slapos!1550 (merged) - Adapt SlapOS SRs to use
zc.buildout 3.0.1+slapos001 -
!29 (merged) - Add a new patch over
zc.buildout 2.7.1+slapos19fixingbuildout bootstrapto support installingzc.buildout 3.0.1and3.0.1+. This is needed to migrate tozc.buildout 3.0.1 -
slapos.recipe.build!20 (merged) - Fix
__init__.pyfiles inside namespaceslapos.recipe -
slapos.recipe.cmmi!17 (merged), rubygemsrecipe!10 (merged) - Adapt imports to moved path in
slapos.recipe.build
This MR is to review our patches over zc.buildout 3.0.1, and not the changes brought by zc.buildout 3.0.1 compared to 2.7.1.
Notable details
Please read the corresponding commits for in-depth descriptions.
-
Respect pinned versions in bootstrap: This is an improvement of a patch we already had to achieve the same thing. The previous patch hardcoded zc.buildout's dependencies: zc.buildoutandsetuptools. Butzc.buildout 3.0.1also haspipandwheelas dependencies. The new solution avoids hardcoding the dependencies. -
Reimplement the extends algorithm: A new implementation that linearises the graph of extended files to properly apply += and -= in the order of the linearisation. This is a brand new, more comprehensive implementation compared to our previous patch over the 2.7.1 implementation.
Note: This changes the behavior ofextendscompared tozc.buildout 3.0.1. We prefer the new behavior.
Future work: investigate using the same linearisation algorithm as Python's MRO, C3 linearisation - currently we use the linearisation algorithm Python used before C3. -
Enable partial support for += / -= with <=: This is a patch we already had before, so the behavior is the same. A solution for full support is discussed in the commit message; this solution would be facilitated by the new linearisation approach to handling extends. -
Use pip wheel+wheel.install_as_eggto produce genuine eggs every time. This also removes the need for .buildout-egg. -
Prevent buildout from implicitly installing setup_requireseggs defined in asetup.pyusing a specially crafted.pydistutils.cfgin a temporary directory that is set to$HOMEfor eachpip wheelcall. -
Add buildout:extra-pathsoption: This option determines what paths zc.buildout will scan for already installed distributions, in addition to./eggsand./develop-eggs. Special valuessys.path,zc.buildoutandlegacyexist, corresponding respectively to the wholesys.path, the paths ofzc.buildoutand its dependencies in the same order as they appear insys.path(the default value), and the legacy behavior (the paths ofzc.buildoutand its dependencies but in a weird order). Settingbuildout:extra-paths=(empty value) enables some isolation from the packages available in the environment. -
Various fixes related to the order in which paths are inserted in sys.pathin generated scripts: notably, when some distributions are found insite-packages, they should be inserted after distributions installed in./eggs, as otherwise another version of the same package insite-packagesmight supersede the intended package in./eggs. -
[DROPPED] Prevent buildout bootstrapfrom linkingsite-packagesand.dist-infopackages in./develop-eggs. This caused too many tests to fail, so it was dropped for now. It may also have hindered legitimate use cases (although not for SlapOS). This means that care must be taken when runningbuildout bootstrap, as it may create.egg-linkfiles in./develop-eggsthat introducesite-packagesin the list of scanned paths until the.egg-linkare deleted manually.
Future work
As mentioned:
-
Investigate using C3 linearisation for extends -
Implement full support for +=/-=with<=
Also:
-
Adapt disabled extendstests: Some tests were disabled instead of being adapted after reimplementingextends. -
(Longstanding bug) Fix ${:_profile_base_location_}implementation: currently if${:_profile_base_location_}is used inside the same section in multiple separate files in theextendsgraph, all will be substituted with the location of the file that occurs last in theextendslinearisation order (i.e. the "most overriding").
The particular case where${:_profile_base_location_}for a given section occurs only in one file thus works as intended. This bug existed before the newextendslinearisation algorithm - it was just less straightforward which location would be used. -
Support .dist-infodistributions as installed by pip:pip install <somepackageresults inpackage(the actual package) andpackage.dist-info(package metadata) being created next to each other in some directory, usuallysite-packages, usually with many other projects in the same directory. Currently setuptools and buildout do not distinguish between packages installed by pip (e.g. insidesite-packagesin a virtual environment) and develop distributions (such as from a git clone). Both are seen asDEVELOP_DIST- although a distinction is that setuptools uses thepkg_resource.DistInfoDistributionsubclass for.dist-infodistributions. This causesbuildout bootstrapto linksite-packagesin./develop-eggs, leading to unexpected consequences as this introducessite-packagesinto the set of paths checked for already-installed eggs. We propose a full solution: (1) Correctly distinguish.dist-infofromDEVELOP_DIST. (2) bundle<somepackage>.dist-infoand into a containing folder .dist (.distbeing chosen by analogy with.eggand.egg-info). (3) This bundle could then be placed inside./eggsand zc.buildout.easy_install adapted to properly handle.distfolders. This is partly what was already done previously to support installing packages withpip install, except the bundle was calledsomepackage.egg, causing issues (as it was not actually an .egg). That was then superseded by usingpip wheel+setuptools.wheel.Wheel.install_as_egg. The goal here would be to letbuildout bootstrapcopy/bundle.dist-infopackages from the environment in./eggs, just like it does with.eggpackages.