Skip to content

Commit 8ae5988

Browse files
committed
fix pip3 install error for example like cutlass-gemm in local build.
Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
1 parent dc00eb6 commit 8ae5988

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

build2cmake/src/templates/cpu/setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ def build_extension(self, ext: CMakeExtension) -> None:
104104
)
105105

106106

107+
{% set python_name = name | replace('-', '_') %}
107108
setup(
108-
name="{{ name }}",
109+
name="{{ python_name }}",
109110
# The version is just a stub, it's not used by the final build artefact.
110111
version="0.1.0",
111-
ext_modules=[CMakeExtension("{{ name }}.{{ ops_name }}")],
112+
ext_modules=[CMakeExtension("{{ python_name }}.{{ ops_name }}")],
112113
cmdclass={"build_ext": CMakeBuild},
113-
packages=find_packages(where="torch-ext", include=["{{ name }}*"]),
114+
packages=find_packages(where="torch-ext", include=["{{ python_name }}*"]),
114115
package_dir={"": "torch-ext"},
115116
{% if data_globs %}
116-
package_data={"{{ name }}": [ {{ data_globs }} ]},
117+
package_data={"{{ python_name }}": [ {{ data_globs }} ]},
117118
{% endif %}
118119
zip_safe=False,
119120
install_requires=["torch"],

build2cmake/src/templates/cuda/setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,17 @@ def build_extension(self, ext: CMakeExtension) -> None:
124124

125125

126126

127+
{% set python_name = name | replace('-', '_') %}
127128
setup(
128-
name="{{ name }}",
129+
name="{{ python_name }}",
129130
# The version is just a stub, it's not used by the final build artefact.
130131
version="0.1.0",
131-
ext_modules=[CMakeExtension("{{ name }}.{{ ops_name }}")],
132+
ext_modules=[CMakeExtension("{{ python_name }}.{{ ops_name }}")],
132133
cmdclass={"build_ext": CMakeBuild},
133-
packages=find_packages(where="torch-ext", include=["{{ name }}*"]),
134+
packages=find_packages(where="torch-ext", include=["{{ python_name }}*"]),
134135
package_dir={"": "torch-ext"},
135136
{% if data_globs %}
136-
package_data={"{{ name }}": [ {{ data_globs }} ]},
137+
package_data={"{{ python_name }}": [ {{ data_globs }} ]},
137138
{% endif %}
138139
zip_safe=False,
139140
install_requires=["torch"],

build2cmake/src/templates/metal/setup.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ def build_extension(self, ext: CMakeExtension) -> None:
104104
)
105105

106106

107+
{% set python_name = name | replace('-', '_') %}
107108
setup(
108-
name="{{ name }}",
109+
name="{{ python_name }}",
109110
# The version is just a stub, it's not used by the final build artefact.
110111
version="0.1.0",
111-
ext_modules=[CMakeExtension("{{ name }}.{{ ops_name }}")],
112+
ext_modules=[CMakeExtension("{{ python_name }}.{{ ops_name }}")],
112113
cmdclass={"build_ext": CMakeBuild},
113-
packages=find_packages(where="torch-ext", include=["{{ name }}*"]),
114+
packages=find_packages(where="torch-ext", include=["{{ python_name }}*"]),
114115
package_dir={"": "torch-ext"},
115116
{% if data_globs %}
116-
package_data={"{{ name }}": [ {{ data_globs }} ]},
117+
package_data={"{{ python_name }}": [ {{ data_globs }} ]},
117118
{% endif %}
118119
zip_safe=False,
119120
install_requires=["torch"],

build2cmake/src/templates/xpu/setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ def build_extension(self, ext: CMakeExtension) -> None:
105105
for filename in os.listdir(extdir / cfg):
106106
move(extdir / cfg / filename, extdir / filename)
107107

108-
108+
{% set python_name = name | replace('-', '_') %}
109109
setup(
110-
name="{{ name }}",
110+
name="{{ python_name }}",
111111
# The version is just a stub, it's not used by the final build artefact.
112112
version="0.1.0",
113-
ext_modules=[CMakeExtension("{{ name }}.{{ ops_name }}")],
113+
ext_modules=[CMakeExtension("{{ python_name }}.{{ ops_name }}")],
114114
cmdclass={"build_ext": CMakeBuild},
115-
packages=find_packages(where="torch-ext", include=["{{ name }}*"]),
115+
packages=find_packages(where="torch-ext", include=["{{ python_name }}*"]),
116116
package_dir={"": "torch-ext"},
117117
{% if data_globs %}
118-
package_data={"{{ name }}": [ {{ data_globs }} ]},
118+
package_data={"{{ python_name }}": [ {{ data_globs }} ]},
119119
{% endif %}
120120
zip_safe=False,
121121
install_requires=["torch"],

0 commit comments

Comments
 (0)