• 
      

    Add flexible support for packaging static media for extensions.

    Review Request #13662 — Created March 24, 2024 and submitted — Latest diff uploaded

    Information

    Djblets
    release-5.x

    Reviewers

    The old Djblets extension packaging code made a number of assumptions
    about how extension static media would be packaged. It had some
    capabilities to override settings (such as providing custom LessCSS
    global variables), but made assumptions on the environmental setup and
    the usage of setuptools.

    This change redoes much of this, splitting
    djblets.extensions.packaging into submodules for static_media and
    setuptools_backend.

    The static_media module contains two classes:

    • StaticMediaBuildContext: Manages state and general configuration for
      building static media.

    • StaticMediaBuilder: Sets up a Django and Pipeline environment and
      initiates the build process.

    This can then be driven by a packaging backend. The setuptools_backend
    module contains the original functions and classes comprising the
    setuptools-based backend, though wrapping the new static_media
    classes. Subclasses can set a custom class for either of the
    static_media classes on the Setuptools backend in order to customize
    behavior.

    One of the features of the new backend is support for defining a
    .npm-workspaces directory, which contains symlinks to other trees that
    may provide static media files that may be needed by the build system.
    This defaults to a djblets symlink, but subclasses can add additional
    backends.

    Down the road, the expectation is that we'll have better support for
    using modern pyproject.toml-configured build backends for
    extensions, and this change would help get us there.

    The original classes can still be imported and used as before, but are
    now deprecated, with useful information on moving to the modern classes.

    Unit tests pass.

    Tested building rbintegrations with this change, both with legacy
    usage in Review Board and with updated usage.

    Commits

    Files