Skip to content

Commit b89cd89

Browse files
committed
Fix bdist_wheel
1 parent 0ea44d9 commit b89cd89

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

scripts/build_developer.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ cd $_SCRIPT_DIR/..
8080
pip uninstall torch_xla torchax torch_xla2 -y
8181

8282
# Build the wheel too, which is useful for other testing purposes.
83+
rm -f torch_xla.egg-info/SOURCES.txt
8384
python3 setup.py bdist_wheel
8485

8586
# Link the source files for local development.

setup.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,14 +335,21 @@ def build_extension(self, ext: Extension) -> None:
335335
long_description = f.read()
336336

337337
# Finds torch_xla and its subpackages
338-
# We specify 'torchax.torchax' to find the nested package correctly.
339-
packages_to_include = find_packages(
340-
include=['torch_xla', 'torch_xla.*', 'torchax', 'torchax.*'])
341-
342-
# Map the top-level 'torchax' package name to its source location
343-
package_dir_mapping = {
344-
'torchax': 'torchax/torchax',
345-
}
338+
# 1. Find `torch_xla` and its subpackages automatically from the root.
339+
packages_to_include = find_packages(include=['torch_xla', 'torch_xla.*'])
340+
341+
# 2. Explicitly find the contents of the nested `torchax` package.
342+
# Find all sub-packages within the torchax directory (e.g., 'ops').
343+
torchax_source_dir = 'torchax/torchax'
344+
torchax_subpackages = find_packages(where=torchax_source_dir)
345+
# Construct the full list of packages, starting with the top-level
346+
# 'torchax' and adding all the discovered sub-packages.
347+
packages_to_include.extend(['torchax'] +
348+
['torchax.' + pkg for pkg in torchax_subpackages])
349+
350+
# 3. The package_dir mapping explicitly tells setuptools where the 'torchax'
351+
# package's source code begins. `torch_xla` source code is inferred.
352+
package_dir_mapping = {'torchax': torchax_source_dir}
346353

347354

348355
class Develop(develop.develop):

0 commit comments

Comments
 (0)