Skip to content

Commit

Permalink
Fix wheel scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheitman committed Dec 27, 2024
1 parent a3e748f commit 30afbe9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ def copy_extension_to_source(self, ext):

if platform.system() == "Linux":
src_filename = os.path.join(self.build_temp + '/src/libtriton', 'triton.so')
dst_filename = os.path.join(self.build_lib, os.path.basename(filename))
dst_filename = os.path.join(self.build_lib, 'triton.so')
elif platform.system() == "Darwin":
src_filename = os.path.join(self.build_temp + '/src/libtriton', 'libtriton.dylib')
dst_filename = os.path.join(self.build_lib, os.path.basename(filename))
dst_filename = os.path.join(self.build_lib, 'libtriton.dylib')
elif platform.system() == "Windows":
src_filename = os.path.join(self.build_temp + '\\src\\libtriton\\Release', 'triton.pyd')
dst_filename = os.path.join(self.build_lib, os.path.basename(filename))
dst_filename = os.path.join(self.build_lib, 'triton.pyd')
else:
raise Exception(f'Platform not supported: {platform.system()}')

Expand Down Expand Up @@ -217,8 +217,7 @@ def copy_autocomplete(self):
install_requires=[],
options={
'bdist_wheel': {
'py_limited_api': 'cp38',
'plat-name': 'manylinux_2_34_x86_64'
'py_limited_api': 'cp38'
}
}
)
8 changes: 4 additions & 4 deletions src/libtriton/bindings/python/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace triton {
throw triton::exceptions::Bindings("triton::bindings::python::PyLong_AsUint(): Bad internal call.");
}

triton::__uint value = triton::__uint(str_value);
triton::__uint value = (triton::__uint) std::strtoul(str_value, 0, 10);

Py_DECREF(py_str);

Expand Down Expand Up @@ -70,7 +70,7 @@ namespace triton {
throw triton::exceptions::Bindings("triton::bindings::python::PyLong_AsUsize(): Bad internal call.");
}

triton::usize value = triton::usize(str_value);
triton::usize value = (triton::usize) std::strtoull(str_value, 0, 10);

Py_DECREF(py_str);

Expand Down Expand Up @@ -98,7 +98,7 @@ namespace triton {
throw triton::exceptions::Bindings("triton::bindings::python::PyLong_AsUint32(): Bad internal call.");
}

triton::uint32 value = (triton::uint32) triton::uint64(str_value);
triton::uint32 value = std::strtoul(str_value, 0, 10);

Py_DECREF(py_str);

Expand Down Expand Up @@ -126,7 +126,7 @@ namespace triton {
throw triton::exceptions::Bindings("triton::bindings::python::PyLong_AsUint64(): Bad internal call.");
}

triton::uint64 value = triton::uint64(str_value);
triton::uint64 value = std::strtoull(str_value, 0, 10);

Py_DECREF(py_str);

Expand Down
18 changes: 9 additions & 9 deletions src/scripts/docker/build-wheel-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; prin

$PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64

# Build Triton Python wheel package for Python 3.9.
echo "[+] Build Triton wheel package for Python 3.9"
cd $SOURCE_DIR
rm -rf $SOURCE_DIR/build
rm -rf $SOURCE_DIR/triton_library.egg-info
export PYTHON_BINARY=/opt/_internal/cpython-3.8.*/bin/python
export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])")
export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])")
# # Build Triton Python wheel package for Python 3.9.
# echo "[+] Build Triton wheel package for Python 3.9"
# cd $SOURCE_DIR
# rm -rf $SOURCE_DIR/build
# rm -rf $SOURCE_DIR/triton_library.egg-info
# export PYTHON_BINARY=/opt/_internal/cpython-3.8.*/bin/python
# export PYTHON_INCLUDE_DIRS=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])")
# export PYTHON_LIBRARY=$($PYTHON_BINARY -c "from sysconfig import get_paths; print(get_paths()['include'])")

$PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64
# $PYTHON_BINARY -m build --wheel --outdir $WHEEL_DIR/linux_x86_64

# # Build Triton Python wheel package for Python 3.9.
# echo "[+] Build Triton wheel package for Python 3.9"
Expand Down

0 comments on commit 30afbe9

Please sign in to comment.