Skip to content

Commit

Permalink
Critical setuptools issue resolved x 3.
Browse files Browse the repository at this point in the history
This commit finalizes the resolution applied by the prior commit to
both the "develop" and "install" setuptools subcommands. Previously,
this resolution applied to only the latter.

Specifically, this commit:

* Mandatory dependencies bumped:
  * setuptools >= 36.7.2. A recent version of setuptools is now
    required, as this application requires the
    setuptools.command.easy_install.ScriptWriter.get_args() class
    method and thus the oldest version of setuptools with this method.
    Since official setuptools documentation fails to specify the exact
    version that first defined this method, we fallback to a
    sufficiently old version from 2017 known to do so.
* Generalized the "setup.py" submodule:
  * Called the newly defined
    betse_setup.buputil.die_unless_setuptools_version_at_least()
    validator to ensure the currently installed version of setuptools
    satisfies all installation-time requirements.
* Generalized the "betse.metadeps" submodule:
  * Defined a new "SETUPTOOLS_VERSION_MIN" global, providing the minimum
    version of "setuptools"required at both install- and runtime.
    Previously, this global was inaccessibly hardcoded into the
    coarse-grained "RUNTIME_MANDATORY" global.
* Generalized the "betse_setup.buputil" submodule.
  * Defined a new die_unless_setuptools_version_at_least() validator,
    copied verbatim from the "betsee.beuputil" submodule.
  * Minimized this submodule to the smallest set of requisite functions
    required by the top-level "setup.py" script.
  • Loading branch information
leycec committed Oct 15, 2019
1 parent f05ba12 commit b00bae5
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 358 deletions.
2 changes: 1 addition & 1 deletion betse/lib/setuptools/command/supcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def add_subcommand(
#FIXME: Type-check each such command to be a "Command". For unknown
#reasons, Python is currently complaining that "freeze_dir" is not a
#"Command", despite clearly being a "Command". </collective_shrug>
*subcommands
*subcommands,
) -> None:
'''
Define one custom :mod:`setuptools` subcommand for each passed class,
Expand Down
31 changes: 19 additions & 12 deletions betse/metadeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@

from collections import namedtuple

# ....................{ LIBS ~ install : mandatory }....................
# This public global is externally referenced by "setup.py".
SETUPTOOLS_VERSION_MIN = '36.7.2'
'''
Minimum version of :mod:`setuptools` required at both application install- and
runtime as a human-readable ``.``-delimited string.
Motivation
----------
This application requires the
:meth:`setuptools.command.easy_install.ScriptWriter.get_args` class method and
hence at least the oldest version of :mod:`setuptools` to have this method.
Since official setuptools documentation fails to specify the exact version that
first defined this method, we fallback to a sufficiently old version from 2017
known to define this method.
'''

# ....................{ LIBS ~ runtime : mandatory }....................
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# WARNING: Changes to this subsection *MUST* be synchronized with:
Expand All @@ -38,19 +55,9 @@
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

RUNTIME_MANDATORY = {
#FIXME: Extract into a global constant and validate at installation time.
#See the BETSEE codebase for requisite logic.

# setuptools is currently required at both install and runtime. At runtime,
# setuptools is used to validate that dependencies are available. Notably:
#
# * setuptools 36.7.2 is the oldest version for which the
# setuptools.command.easy_install.ScriptWriter.get_script_args() class
# method is known to have been deprecated. Technically, older versions
# probably exist. Since official setuptools documentation fails to
# specify the exact version that first deprecated this method, we have no
# sane recourse but to accept this "old enough" version from 2017.
'setuptools': '>= 36.7.2',
# setuptools is used to validate that dependencies are available.
'setuptools': '>= ' + SETUPTOOLS_VERSION_MIN,

# Dependencies directly required by this application. Notably:
#
Expand Down
Loading

0 comments on commit b00bae5

Please sign in to comment.