Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion graalpython/lib-graalpython/patches/metadata.toml
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,11 @@ version = '>= 1.2.2'
patch = 'setproctitle-1.2.2.patch'
license = 'BSD-3-Clause'

[[setuptools.rules]]
version = '>= 70.1.0'
patch = 'setuptools.patch'
license = 'MIT'

[[tensorflow.rules]]
version = '== 2.15.0'
patch = 'tensorflow-2.15.0.patch'
Expand Down Expand Up @@ -897,6 +902,12 @@ patch = 'torch-2.7.0.patch'
license = 'BSD-3-Clause'
dist-type = 'sdist'

[[torch.rules]]
version = '== 2.10.0'
patch = 'torch-2.10.0.patch'
license = 'BSD-3-Clause'
dist-type = 'sdist'

[[torch.add-sources]]
version = '1.13.1'
url = 'https://github.com/pytorch/pytorch/releases/download/v1.13.1/pytorch-v1.13.1.tar.gz'
Expand All @@ -913,8 +924,16 @@ url = 'https://github.com/pytorch/pytorch/releases/download/v2.4.1/pytorch-v2.4.
version = '2.7.0'
url = 'https://github.com/pytorch/pytorch/releases/download/v2.7.0/pytorch-v2.7.0.tar.gz'

[[torch.add-sources]]
version = '2.10.0'
url = 'https://github.com/pytorch/pytorch/releases/download/v2.10.0/pytorch-v2.10.0.tar.gz'

[[torchvision.add-sources]]
version = '0.25.0'
url = 'https://github.com/pytorch/vision/archive/refs/tags/v0.25.0.tar.gz'

[[torchvision.rules]]
version = '== 0.22.0'
version = '>= 0.22.0'
patch = 'torchvision-0.22.0.patch'
license = 'BSD-3-Clause'

Expand Down
82 changes: 82 additions & 0 deletions graalpython/lib-graalpython/patches/setuptools.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
diff --git a/setuptools/_vendor/wheel/wheelfile.py b/setuptools/_vendor/wheel/wheelfile.py
index 7b6fd71..6b58a2f 100644
--- a/setuptools/_vendor/wheel/wheelfile.py
+++ b/setuptools/_vendor/wheel/wheelfile.py
@@ -184,7 +184,9 @@ class WheelFile(ZipFile):
) -> None:
with open(filename, "rb") as f:
st = os.fstat(f.fileno())
- data = f.read()
+ data = []
+ while chunk := f.read(4194304):
+ data.append(chunk)

zinfo = ZipInfo(
arcname or filename, date_time=get_zipinfo_datetime(st.st_mtime)
@@ -209,7 +211,10 @@ class WheelFile(ZipFile):
if isinstance(data, str):
data = data.encode("utf-8")

- ZipFile.writestr(self, zinfo_or_arcname, data, compress_type)
+ # GraalPy change
+ if not isinstance(data, list):
+ data = [data]
+ self.writestr_list(zinfo_or_arcname, data, compress_type)
fname = (
zinfo_or_arcname.filename
if isinstance(zinfo_or_arcname, ZipInfo)
@@ -217,12 +222,52 @@ class WheelFile(ZipFile):
)
log.info("adding %r", fname)
if fname != self.record_path:
- hash_ = self._default_algorithm(data)
+ hash_ = self._default_algorithm()
+ for chunk in data:
+ hash_.update(chunk)
self._file_hashes[fname] = (
hash_.name,
urlsafe_b64encode(hash_.digest()).decode("ascii"),
)
- self._file_sizes[fname] = len(data)
+ self._file_sizes[fname] = sum(map(len, data))
+
+ # GraalPy change: version that accepts data as a list of bytes chunks, to
+ # avoid running into the 2GB limit for bytes object size
+ def writestr_list(self, zinfo_or_arcname, data,
+ compress_type=None, compresslevel=None):
+ if not isinstance(zinfo_or_arcname, ZipInfo):
+ zinfo = ZipInfo(filename=zinfo_or_arcname,
+ date_time=time.localtime(time.time())[:6])
+ zinfo.compress_type = self.compression
+ zinfo._compresslevel = self.compresslevel
+ if zinfo.filename[-1] == '/':
+ zinfo.external_attr = 0o40775 << 16 # drwxrwxr-x
+ zinfo.external_attr |= 0x10 # MS-DOS directory flag
+ else:
+ zinfo.external_attr = 0o600 << 16 # ?rw-------
+ else:
+ zinfo = zinfo_or_arcname
+
+ if not self.fp:
+ raise ValueError(
+ "Attempt to write to ZIP archive that was already closed")
+ if self._writing:
+ raise ValueError(
+ "Can't write to ZIP archive while an open writing handle exists."
+ )
+
+ if compress_type is not None:
+ zinfo.compress_type = compress_type
+
+ if compresslevel is not None:
+ zinfo._compresslevel = compresslevel
+
+ zinfo.file_size = sum(map(len, data)) # Uncompressed size
+ with self._lock:
+ with self.open(zinfo, mode='w') as dest:
+ for chunk in data:
+ dest.write(chunk)
+

def close(self) -> None:
# Write RECORD
Loading
Loading