Skip to content

Commit 1f8938e

Browse files
committed
Change name convention for PyPI uploads (#2023)
Summary: Pull Request resolved: #2023 PyPI does not accept version to be specified with `+` (e.g., `+cpu` or `+cu118`). Reviewed By: sryap Differential Revision: D49329679 fbshipit-source-id: 1bc0c81ae15fdf157b54b2ca9226d67dacaade8e
1 parent 5a40006 commit 1f8938e

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

fbgemm_gpu/setup.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ def main(argv: List[str]) -> None:
266266
if len(unknown) != 0 and (len(unknown) != 1 or unknown[0] != "clean"):
267267
print("Unknown Arguments: ", unknown)
268268

269+
if args.cpu_only:
270+
version_variant = "+cpu"
271+
else:
272+
set_cuda_environment_variables()
273+
if torch.version.cuda is not None:
274+
cuda_version = torch.version.cuda.split(".")
275+
version_variant = "+cu" + str(cuda_version[0]) + str(cuda_version[1])
276+
else:
277+
# rocm or other gpus - to be specified if we offcially support them
278+
version_variant = ""
279+
269280
# Skip Nova build steps since it will be done in pre-script
270281
if "BUILD_FROM_NOVA" in os.environ:
271282
build_from_nova = os.getenv("BUILD_FROM_NOVA")
@@ -277,18 +288,10 @@ def main(argv: List[str]) -> None:
277288
print("Build from Nova detected... exiting")
278289
sys.exit(0)
279290
else:
291+
# If not building from Nova, use the fbgemm_gpu-<variant>
292+
# PyPi does not accept version+xx in the name convention.
293+
version_variant = ""
280294
package_name = args.package_name
281-
282-
if args.cpu_only:
283-
version_variant = "+cpu"
284-
else:
285-
set_cuda_environment_variables()
286-
if torch.version.cuda is not None:
287-
cuda_version = torch.version.cuda.split(".")
288-
version_variant = "+cu" + str(cuda_version[0]) + str(cuda_version[1])
289-
else:
290-
version_variant = ""
291-
292295
# Repair command line args for setup.
293296
sys.argv = [sys.argv[0]] + unknown
294297

0 commit comments

Comments
 (0)