Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-hatchling for 
openSUSE:Factory checked in at 2026-07-10 17:33:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-hatchling (Old)
 and      /work/SRC/openSUSE:Factory/.python-hatchling.new.1991 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-hatchling"

Fri Jul 10 17:33:50 2026 rev:36 rq:1364668 version:1.31.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-hatchling/python-hatchling.changes        
2026-06-04 18:53:50.895718639 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-hatchling.new.1991/python-hatchling.changes  
    2026-07-10 17:34:27.247063016 +0200
@@ -1,0 +2,9 @@
+Wed Jul  8 19:24:20 UTC 2026 - BenoĆ®t Monin <[email protected]>
+
+- update to version 1.31.0:
+  * Fixed: Only rewrite the shebang of a shared script when
+    a Python shebang is present on the first line, preserving
+    binary files and other content verbatim instead of dropping
+    leading bytes.
+
+-------------------------------------------------------------------

Old:
----
  hatchling-1.30.1.tar.gz

New:
----
  hatchling-1.31.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-hatchling.spec ++++++
--- /var/tmp/diff_new_pack.2fLqW7/_old  2026-07-10 17:34:29.179128946 +0200
+++ /var/tmp/diff_new_pack.2fLqW7/_new  2026-07-10 17:34:29.179128946 +0200
@@ -24,7 +24,7 @@
 %{?pythons_for_pypi}
 %{?sle15_python_module_pythons}
 Name:           python-hatchling
-Version:        1.30.1
+Version:        1.31.0
 Release:        0
 Summary:        Build backend used by Hatch
 License:        MIT

++++++ hatchling-1.30.1.tar.gz -> hatchling-1.31.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatchling-1.30.1/PKG-INFO 
new/hatchling-1.31.0/PKG-INFO
--- old/hatchling-1.30.1/PKG-INFO       2020-02-02 01:00:00.000000000 +0100
+++ new/hatchling-1.31.0/PKG-INFO       2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.4
 Name: hatchling
-Version: 1.30.1
+Version: 1.31.0
 Summary: Modern, extensible Python build backend
 Project-URL: Homepage, https://hatch.pypa.io/latest/
 Project-URL: Sponsor, https://github.com/sponsors/ofek
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatchling-1.30.1/src/hatchling/__about__.py 
new/hatchling-1.31.0/src/hatchling/__about__.py
--- old/hatchling-1.30.1/src/hatchling/__about__.py     2020-02-02 
01:00:00.000000000 +0100
+++ new/hatchling-1.31.0/src/hatchling/__about__.py     2020-02-02 
01:00:00.000000000 +0100
@@ -1 +1 @@
-__version__ = "1.30.1"
+__version__ = "1.31.0"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hatchling-1.30.1/src/hatchling/builders/wheel.py 
new/hatchling-1.31.0/src/hatchling/builders/wheel.py
--- old/hatchling-1.30.1/src/hatchling/builders/wheel.py        2020-02-02 
01:00:00.000000000 +0100
+++ new/hatchling-1.31.0/src/hatchling/builders/wheel.py        2020-02-02 
01:00:00.000000000 +0100
@@ -37,6 +37,10 @@
 
 TIME_TUPLE = tuple[int, int, int, int, int, int]
 
+# The Linux kernel only reads the first BINPRM_BUF_SIZE (256) bytes of a 
shebang
+# line, so anything longer cannot be a functional shebang and is left 
untouched.
+MAX_SHEBANG_LENGTH = 256
+
 
 class FileSelectionOptions(NamedTuple):
     include: list[str]
@@ -162,6 +166,10 @@
         shared_file.distribution_path = 
f"{self.shared_data_directory}/data/{shared_file.distribution_path}"
         return self.add_file(shared_file)
 
+    def add_shared_script(self, shared_script: IncludedFile) -> tuple[str, 
str, str]:
+        shared_script.distribution_path = 
f"{self.shared_data_directory}/scripts/{shared_script.distribution_path}"
+        return self.add_file(shared_script)
+
     def add_extra_metadata_file(self, extra_metadata_file: IncludedFile) -> 
tuple[str, str, str]:
         extra_metadata_file.distribution_path = (
             
f"{self.metadata_directory}/extra_metadata/{extra_metadata_file.distribution_path}"
@@ -681,24 +689,28 @@
 
         for shared_script in self.recurse_explicit_files(shared_scripts):
             with open(shared_script.path, "rb") as f:
-                content = BytesIO()
-                for line in f:
-                    # Ignore leading blank lines
-                    if not line.strip():
-                        continue
-
-                    match = shebang.match(line)
-                    if match is None:
-                        content.write(line)
+                prefix = f.read(2)
+
+                # A shebang is only honored on the first line starting at the 
very
+                # first byte, so anything else is kept as is.
+                if prefix != b"#!":
+                    record = archive.add_shared_script(shared_script)
+                else:
+                    line = prefix + f.readline(MAX_SHEBANG_LENGTH - 
len(prefix))
+                    if len(line) == MAX_SHEBANG_LENGTH and not 
line.endswith(b"\n"):
+                        # The line is too long to be a functional shebang.
+                        record = archive.add_shared_script(shared_script)
+                    elif (match := shebang.match(line)) is None:
+                        record = archive.add_shared_script(shared_script)
                     else:
+                        content = BytesIO()
                         content.write(b"#!python")
                         if remaining := match.group(1):
                             content.write(remaining)
+                        content.write(f.read())
 
-                    content.write(f.read())
-                    break
+                        record = archive.write_shared_script(shared_script, 
content.getvalue())
 
-            record = archive.write_shared_script(shared_script, 
content.getvalue())
             records.write(record)
 
     def add_sboms(self, archive: WheelArchive, records: RecordFile, 
build_data: dict[str, Any]) -> None:

Reply via email to