Description: Disables git command to get current version of the package and use of
 Version structure at command. Currently version is being hardcoded in order to
 make px --version command work.
Author: Josue Ortega <josue@debian.org>
Last-Update: 2025-03-27
Forwarded: not-needed

--- a/setup.py
+++ b/setup.py
@@ -9,67 +9,7 @@
 
 from setuptools import setup
 
-VERSIONFILE = "px/version.py"
-
-
-def write_version(version: str, replace: bool = False) -> None:
-    """
-    Write the given version to px/version.py.
-
-    If px/version.py is missing, the version will always be written.
-
-    If px/version.py is present, the version will only be written if replace is True.
-    """
-    with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as tmp:
-        tmp.write(
-            b"# NOTE: Auto generated by update_version_py() in setup.py, no touchie!\n"
-        )
-        tmp.write(b'VERSION = "%s"\n' % bytearray(version, "utf_8"))
-
-        # Flushing is required for filecmp.cmp() to work (below)
-        tmp.flush()
-
-        if not os.path.isfile(VERSIONFILE):
-            # No version file found
-            print(f"Creating {VERSIONFILE} with version {version}")
-            shutil.move(tmp.name, VERSIONFILE)
-        elif replace and not filecmp.cmp(tmp.name, VERSIONFILE):
-            print(f"Updating {VERSIONFILE} to new version {version}")
-            shutil.move(tmp.name, VERSIONFILE)
-        else:
-            # VERSIONFILE was already up to date. If we touch it in this case,
-            # it will have its file timestamp updated, which will force the slow
-            # px_integration_test.py tests to get rerun.
-            #
-            # Just clean up our tempfile and be merry.
-            print(f"Not touching existing {VERSIONFILE}")
-            os.remove(tmp.name)
-
-
-def update_version_py() -> str:
-    """
-    Update px/version.py with the current git version.
-
-    Returns the version number.
-    """
-    git_result = subprocess.run(["git", "describe", "--dirty"], capture_output=True)
-    if git_result.returncode == 0:
-        write_version(git_result.stdout.decode("utf-8").strip(), True)
-    else:
-        # Don't overwrite any existing version since we just made this one up
-        write_version("0.0.0", False)
-
-    from px import version
-
-    return version.VERSION
-
-
 if __name__ == "__main__":
-    version_for_setuptools = update_version_py()
-
-    if not re.match(r"^[0-9]+\.[0-9]+\.[0-9]+$", version_for_setuptools):
-        # Setuptools requires a nice version number
-        version_for_setuptools = "0.0.0"
 
     with open(
         os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
@@ -78,7 +18,7 @@
 
     setup(
         name="pxpx",
-        version=version_for_setuptools,
+        version="3.6.12",
         description="ps and top for Human Beings",
         long_description=LONG_DESCRIPTION,
         long_description_content_type="text/x-rst",
--- a/px/px.py
+++ b/px/px.py
@@ -59,6 +59,8 @@
 from typing import Optional, List
 
 
+VERSION = "3.6.12"
+
 ERROR_REPORTING_HEADER = """
 ---
 
@@ -139,9 +141,9 @@
     # even if we don't use it. And this will make test avoidance fail to avoid
     # px.py tests every time you make a new commit (because committing recreates
     # version.py).
-    from . import version
 
-    sys.stderr.write("px version: " + version.VERSION + "\n")
+
+    sys.stderr.write("px version: " + VERSION + "\n")
 
     sys.stderr.write("\n")
     sys.stderr.write("Python version: " + sys.version + "\n")
@@ -168,9 +170,8 @@
         # NOTE: If we "import version" at the top of this file, we will depend on it even if
         # we don't use it. And this will make test avoidance fail to avoid px.py tests every
         # time you make a new commit (because committing recreates version.py).
-        from . import version
 
-        print(version.VERSION)
+        print(VERSION)
         return
 
     with_pager: Optional[bool] = None
