-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdeploy-conda.bat
55 lines (43 loc) · 1.78 KB
/
deploy-conda.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
:: taken from: https://medium.com/@giswqs/building-a-conda-package-and-uploading-it-to-anaconda-cloud-6a3abd1c5c52
:: run this line of code if you don't have a skeleton directory (./data-science-utils).
:: conda skeleton pypi data-science-utils --python-version 3.6
:: Extract version from __init__.py
for /F "tokens=2 delims== " %%i in ('findstr /R "__version__[^=]*=" ds_utils\__init__.py') do (
set version=%%i
)
set version=%version:"=%
:: Get numpy version
for /f "delims=" %%v in ('python -c "import numpy; print(numpy.__version__)"') do (
set numpy_version=%%v
)
:: Create output directory if it doesn't exist
if not exist .\outputdir mkdir .\outputdir
:: Build for different Python versions
for %%v in (3.9 3.10 3.11 3.12) do (
call conda build --python %%v data-science-utils --numpy %numpy_version% --output-folder outputdir\
)
call conda build purge
:: Convert packages for all Python versions and platforms
for %%v in (39 310 311 312) do (
call conda convert -f --platform all outputdir\win-64\data-science-utils-%version%-py%%v_0.tar.bz2 -o outputdir\
)
:: Get available platforms from conda convert help
:: First, find the line containing -p or --platform
for /f "tokens=1,* delims={}" %%a in ('conda convert --help ^| findstr /C:"-p {" /C:"--platform {"') do (
set "platforms_str=%%b"
)
:: Remove trailing text after } to get clean platform list
for /f "tokens=1 delims=}" %%a in ("%platforms_str%") do (
set "platforms_str=%%a"
)
:: Login to Anaconda
anaconda login --username IdanMorad
:: Upload packages for all Python versions and platforms
for %%v in (39 310 311 312) do (
for %%p in (%platforms_str%) do (
if not "%%p"=="all" (
call anaconda upload outputdir/%%p/data-science-utils-%version%-py%%v_0.tar.bz2
)
)
)
anaconda logout