Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 3902f51

Browse files
authored
extensionName -> moduleName (#298)
1 parent 49b78f0 commit 3902f51

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

lib/torch-extension/arch.nix

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ assert (buildConfig ? xpuVersion) -> xpuSupport;
6565
assert (buildConfig.metal or false) -> stdenv.hostPlatform.isDarwin;
6666

6767
let
68-
extensionName = builtins.replaceStrings [ "-" ] [ "_" ] kernelName;
68+
moduleName = builtins.replaceStrings [ "-" ] [ "_" ] kernelName;
6969

7070
# On Darwin, we need the host's xcrun for `xcrun metal` to compile Metal shaders.
7171
# It's not supported by the nixpkgs shim.
@@ -80,11 +80,11 @@ let
8080
in
8181

8282
stdenv.mkDerivation (prevAttrs: {
83-
name = "${extensionName}-torch-ext";
83+
name = "${kernelName}-torch-ext";
8484

8585
inherit
8686
doAbiCheck
87-
extensionName
87+
moduleName
8888
nvccThreads
8989
src
9090
;
@@ -232,15 +232,15 @@ stdenv.mkDerivation (prevAttrs: {
232232
postInstall = ''
233233
(
234234
cd ..
235-
cp -r torch-ext/${extensionName}/* $out/
235+
cp -r torch-ext/${moduleName}/* $out/
236236
)
237-
mv $out/_${extensionName}_*/* $out/
238-
rm -d $out/_${extensionName}_${rev}
237+
mv $out/_${moduleName}_*/* $out/
238+
rm -d $out/_${moduleName}_${rev}
239239
240240
# Set up a compatibility module for older kernels versions, remove when
241241
# the updated kernels has been around for a while.
242-
mkdir $out/${extensionName}
243-
cp ${./compat.py} $out/${extensionName}/__init__.py
242+
mkdir $out/${moduleName}
243+
cp ${./compat.py} $out/${moduleName}/__init__.py
244244
''
245245
+ (lib.optionalString (stripRPath && stdenv.hostPlatform.isLinux)) ''
246246
find $out/ -name '*.so' \

lib/torch-extension/no-arch.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
}:
2323

2424
let
25-
extensionName = builtins.replaceStrings [ "-" ] [ "_" ] kernelName;
25+
moduleName = builtins.replaceStrings [ "-" ] [ "_" ] kernelName;
2626
in
2727

2828
stdenv.mkDerivation (prevAttrs: {
2929
name = "${kernelName}-torch-ext";
3030

31-
inherit extensionName src;
31+
inherit moduleName src;
3232

3333
# Add Torch as a dependency, so that devshells for universal kernels
3434
# also get torch as a build input.
@@ -54,9 +54,9 @@ stdenv.mkDerivation (prevAttrs: {
5454

5555
installPhase = ''
5656
mkdir -p $out
57-
cp -r torch-ext/${extensionName}/* $out/
58-
mkdir $out/${extensionName}
59-
cp ${./compat.py} $out/${extensionName}/__init__.py
57+
cp -r torch-ext/${moduleName}/* $out/
58+
mkdir $out/${moduleName}
59+
cp ${./compat.py} $out/${moduleName}/__init__.py
6060
'';
6161

6262
doInstallCheck = true;

pkgs/get-kernel-check/get-kernel-check-hook.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ echo "Sourcing get-kernel-check-hook.sh"
55
_getKernelCheckHook() {
66
echo "Checking loading kernel with get_kernel"
77

8-
if [ -z ${extensionName+x} ]; then
9-
echo "extensionName must be set in derivation"
8+
if [ -z ${moduleName+x} ]; then
9+
echo "moduleName must be set in derivation"
1010
exit 1
1111
fi
1212

13-
echo "Check whether the kernel can be loaded with get-kernel: ${extensionName}"
13+
echo "Check whether the kernel can be loaded with get-kernel: ${moduleName}"
1414

1515
# We strip the full library paths from the extension. Unfortunately,
1616
# in a Nix environment, the library dependencies cannot be found
@@ -35,7 +35,7 @@ _getKernelCheckHook() {
3535
mkdir -p "${TMPDIR}/build"
3636
ln -s "$out" "${TMPDIR}/build/${BUILD_VARIANT}"
3737

38-
python -c "from pathlib import Path; import kernels; kernels.get_local_kernel(Path('${TMPDIR}'), '${extensionName}')"
38+
python -c "from pathlib import Path; import kernels; kernels.get_local_kernel(Path('${TMPDIR}'), '${moduleName}')"
3939
}
4040

4141
postInstallCheckHooks+=(_getKernelCheckHook)

pkgs/kernel-layout-check/kernel-layout-check-hook.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ echo "Sourcing kernel-layout-check-hook.sh"
55
kernelLayoutCheckHook() {
66
echo "Checking kernel layout"
77

8-
if [ -z ${extensionName+x} ]; then
9-
echo "extensionName must be set in derivation"
8+
if [ -z ${moduleName+x} ]; then
9+
echo "moduleName must be set in derivation"
1010
exit 1
1111
fi
1212

13-
if [ ! -f source/torch-ext/${extensionName}/__init__.py ]; then
14-
echo "Python module at source/torch-ext/${extensionName} must contain __init__.py"
13+
if [ ! -f source/torch-ext/${moduleName}/__init__.py ]; then
14+
echo "Python module at source/torch-ext/${moduleName} must contain __init__.py"
1515
exit 1
1616
fi
1717

1818
# TODO: remove once the old location is removed from kernels.
19-
if [ -e source/torch-ext/${extensionName}/${extensionName} ]; then
20-
echo "Python module at source/torch-ext/${extensionName} must not have ${extensionName} file or directory."
19+
if [ -e source/torch-ext/${moduleName}/${moduleName} ]; then
20+
echo "Python module at source/torch-ext/${moduleName} must not have ${moduleName} file or directory."
2121
exit 1
2222
fi
2323
}

0 commit comments

Comments
 (0)