Unverified Commit 82c3e334 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

python313Packages.debugpy: make src reproducible (#468328)

parents 8645d7de a2457971
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -32,15 +32,20 @@ buildPythonPackage rec {
    owner = "microsoft";
    repo = "debugpy";
    tag = "v${version}";

    # Upstream uses .gitattributes to inject information about the revision
    # hash and the refname into `src/debugpy/_version.py`, see:
    #
    # - https://git-scm.com/docs/gitattributes#_export_subst and
    # - https://github.com/microsoft/debugpy/blob/v1.8.17/src/debugpy/_version.py#L24-L30
    postFetch = ''
      sed -i 's/git_refnames = "[^"]*"/git_refnames = " (tag: ${src.tag})"/' "$out/src/debugpy/_version.py"
    '';

    hash = "sha256-eAiCtSJUqLASapxnYCyq1UCiGz6QmKQum7Vs3MoU1s8=";
  };

  patches = [
    # Use nixpkgs version instead of versioneer
    (replaceVars ./hardcode-version.patch {
      inherit version;
    })

    # Fix importing debugpy in:
    # - test_nodebug[module-launch(externalTerminal)]
    # - test_nodebug[module-launch(integratedTerminal)]
+0 −47
Original line number Diff line number Diff line
diff --git a/setup.py b/setup.py
index d16a27c5..a7e407e1 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,6 @@ import sys
 
 
 sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
-import versioneer  # noqa
 
 del sys.path[0]
 
@@ -145,13 +144,13 @@ if __name__ == "__main__":
     if platforms is not None:
         extras["platforms"] = platforms
 
-    cmds = versioneer.get_cmdclass()
+    cmds = {}
     override_build(cmds)
     override_build_py(cmds)
 
     setuptools.setup(
         name="debugpy",
-        version=versioneer.get_version(),
+        version="@version@",
         description="An implementation of the Debug Adapter Protocol for Python",  # noqa
         long_description=long_description,
         long_description_content_type="text/markdown",
diff --git a/src/debugpy/public_api.py b/src/debugpy/public_api.py
index c61a2607..f26f8272 100644
--- a/src/debugpy/public_api.py
+++ b/src/debugpy/public_api.py
@@ -7,8 +7,6 @@ from __future__ import annotations
 import functools
 import typing
 
-from debugpy import _version
-
 
 # Expose debugpy.server API from subpackage, but do not actually import it unless
 # and until a member is invoked - we don't want the server package loaded in the
@@ -192,4 +190,4 @@ def trace_this_thread(__should_trace: bool):
     """
 
 
-__version__: str = _version.get_versions()["version"]
+__version__: str = "@version@"