Skip to content

Commit 1167a7c

Browse files
committed
Add building wheel packages
1 parent 8d05d43 commit 1167a7c

4 files changed

Lines changed: 76 additions & 14 deletions

File tree

conda-recipe/bld.bat

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
1-
2-
@rem Remember to activate compiler, if needed
1+
echo on
2+
rem set CFLAGS=-I%PREFIX%\Library\include %CFLAGS%
3+
rem set LDFLAGS=/LIBPATH:%PREFIX% %LDFLAGS%
34

45
set MKLROOT=%CONDA_PREFIX%
5-
%PYTHON% -m pip install --no-build-isolation --no-deps .
6-
if errorlevel 1 exit 1
6+
7+
"%PYTHON%" setup.py clean --all
8+
9+
:: Make CMake verbose
10+
set "VERBOSE=1"
11+
12+
:: -wnx flags mean: --wheel --no-isolation --skip-dependency-check
13+
%PYTHON% -m build -w -n -x
14+
if %ERRORLEVEL% neq 0 exit 1
15+
16+
:: `pip install dist\numpy*.whl` does not work on windows,
17+
:: so use a loop; there's only one wheel in dist/ anyway
18+
for /f %%f in ('dir /b /S .\dist') do (
19+
%PYTHON% -m wheel tags --remove --build %GIT_DESCRIBE_NUMBER% %%f
20+
if %ERRORLEVEL% neq 0 exit 1
21+
)
22+
23+
:: wheel file was renamed
24+
for /f %%f in ('dir /b /S .\dist') do (
25+
%PYTHON% -m pip install %%f ^
26+
--no-build-isolation ^
27+
--no-deps ^
28+
--only-binary :all: ^
29+
--no-index ^
30+
--prefix %PREFIX% ^
31+
-vv
32+
if %ERRORLEVEL% neq 0 exit 1
33+
)
34+
35+
:: Copy wheel package
36+
if NOT "%WHEELS_OUTPUT_FOLDER%"=="" (
37+
copy dist\mkl_service*.whl %WHEELS_OUTPUT_FOLDER%
38+
if %ERRORLEVEL% neq 0 exit 1
39+
)

conda-recipe/build.sh

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1-
#!/bin/bash -x
1+
#!/bin/bash
2+
set -ex
23

3-
# make sure that compiler has been sourced, if necessary
4+
export MKLROOT=$CONDA_PREFIX
45

5-
MKLROOT=$CONDA_PREFIX $PYTHON -m pip install --no-build-isolation --no-deps .
6+
read -r GLIBC_MAJOR GLIBC_MINOR <<<"$(conda list '^sysroot_linux-64$' \
7+
| tail -n 1 | awk '{print $2}' | grep -oP '\d+' | head -n 2 | tr '\n' ' ')"
8+
9+
${PYTHON} setup.py clean --all
10+
11+
# Make CMake verbose
12+
export VERBOSE=1
13+
14+
# -wnx flags mean: --wheel --no-isolation --skip-dependency-check
15+
${PYTHON} -m build -w -n -x
16+
17+
${PYTHON} -m wheel tags --remove --build "$GIT_DESCRIBE_NUMBER" \
18+
--platform-tag "manylinux_${GLIBC_MAJOR}_${GLIBC_MINOR}_x86_64" \
19+
dist/mkl_service*.whl
20+
21+
${PYTHON} -m pip install dist/mkl_service*.whl \
22+
--no-build-isolation \
23+
--no-deps \
24+
--only-binary :all: \
25+
--no-index \
26+
--prefix "${PREFIX}" \
27+
-vv
28+
29+
# Copy wheel package
30+
if [[ -d "${WHEELS_OUTPUT_FOLDER}" ]]; then
31+
cp dist/mkl_service*.whl "${WHEELS_OUTPUT_FOLDER[@]}"
32+
fi

conda-recipe/meta.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
{% set version = "2.5.0" %}
2-
{% set buildnumber = 0 %}
3-
41
package:
52
name: mkl-service
6-
version: {{ version }}
3+
version: {{ GIT_DESCRIBE_TAG }}
74

85
source:
96
path: ..
107

118
build:
12-
number: {{ buildnumber }}
9+
number: {{ GIT_DESCRIBE_NUMBER }}
10+
script_env:
11+
- WHEELS_OUTPUT_FOLDER
1312
ignore_run_exports:
1413
- blas
1514
- mkl-service
@@ -19,12 +18,15 @@ requirements:
1918
- {{ compiler('c') }}
2019
host:
2120
- python
21+
- pip >=25.0
2222
- setuptools >=77
2323
- mkl-devel
2424
- cython
25+
- wheel >=0.45.1
26+
- python-build >=1.2.2
2527
run:
2628
- python
27-
- mkl
29+
- {{ pin_compatible('mkl') }}
2830

2931
test:
3032
requires:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
[build-system]
2727
build-backend = "setuptools.build_meta"
28-
requires = ["setuptools>=77", "Cython"]
28+
requires = ["setuptools>=77", "Cython", "wheel>=0.45.1", "build>=1.2.2"]
2929

3030
[project]
3131
authors = [

0 commit comments

Comments
 (0)