Rework Python temp directory

- Make temp dir consistent using underscore
- Fixup TEMP_DIR in build_delivery_* scripts
This commit is contained in:
Corentin Le Molgat
2018-10-01 10:30:25 +02:00
parent c934a8e296
commit 49247b4898
9 changed files with 51 additions and 33 deletions

3
.gitignore vendored
View File

@@ -31,12 +31,11 @@ classes/
temp_test/
temp_fz/
temp_fz_test/
temp-python*
temp_python*
temp_dotnet/
temp_dotnet_test/
temp_archive/
temp_fz_archive/
temp/ortools_examples
lib/
install/
examples/csharp/solution/*.csproj

View File

@@ -758,12 +758,12 @@ clean_python:
-$(DEL) $(GEN_PATH)$Sortools$Sutil$S_pywrap*
-$(DEL) $(LIB_DIR)$S_pywrap*.$(SWIG_PYTHON_LIB_SUFFIX)
-$(DEL) $(OBJ_DIR)$Sswig$S*python_wrap.$O
-$(DELREC) temp-python*
-$(DELREC) temp_python*
#####################
## Pypi artifact ##
#####################
PYPI_ARCHIVE_TEMP_DIR = temp-python$(PYTHON_VERSION)
PYPI_ARCHIVE_TEMP_DIR = temp_python$(PYTHON_VERSION)
# PEP 513 auditwheel repair overwrite rpath to $ORIGIN/<ortools_root>/.libs
# We need to copy all dynamic libs here
@@ -984,27 +984,42 @@ install_python: pypi_archive
uninstall_python:
"$(PYTHON_EXECUTABLE)" -m pip uninstall ortools
TEMP_PYTHON_DIR=temp_python
.PHONY: python_examples_archive # Build stand-alone Python examples archive file for redistribution.
python_examples_archive:
-$(DELREC) temp
$(MKDIR) temp
$(MKDIR) temp$Sortools_examples
$(MKDIR) temp$Sortools_examples$Sexamples
$(MKDIR) temp$Sortools_examples$Sexamples$Spython
$(MKDIR) temp$Sortools_examples$Sexamples$Snotebook
$(MKDIR) temp$Sortools_examples$Sexamples$Sdata
$(COPY) examples$Spython$S*.py temp$Sortools_examples$Sexamples$Spython
$(COPY) examples$Snotebook$S*.ipynb temp$Sortools_examples$Sexamples$Snotebook
$(COPY) examples$Snotebook$S*.md temp$Sortools_examples$Sexamples$Snotebook
$(COPY) tools$SREADME.examples.python temp$Sortools_examples$SREADME.txt
$(COPY) LICENSE-2.0.txt temp$Sortools_examples
-$(DELREC) $(TEMP_PYTHON_DIR)
$(MKDIR) $(TEMP_PYTHON_DIR)
$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples
$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples
$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython
$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook
$(MKDIR) $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Sdata
$(COPY) $(PYTHON_EX_PATH)$S*.py $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Spython
$(COPY) examples$Snotebook$S*.ipynb $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook
$(COPY) examples$Snotebook$S*.md $(TEMP_PYTHON_DIR)$Sortools_examples$Sexamples$Snotebook
$(COPY) tools$SREADME.examples.python $(TEMP_PYTHON_DIR)$Sortools_examples$SREADME.txt
$(COPY) LICENSE-2.0.txt $(TEMP_PYTHON_DIR)$Sortools_examples
ifeq ($(SYSTEM),win)
cd temp\ortools_examples && ..\..\$(TAR) -C ..\.. -c -v --exclude *svn* --exclude *roadef* --exclude *vector_packing* examples\data | ..\..\$(TAR) xvm
cd temp && ..\$(ZIP) -r ..\or-tools_python_examples_v$(OR_TOOLS_VERSION).zip ortools_examples
cd $(TEMP_PYTHON_DIR)\ortools_examples \
&& ..\..\$(TAR) -C ..\.. -c -v \
--exclude *svn* --exclude *roadef* --exclude *vector_packing* \
examples\data | ..\..\$(TAR) xvm
cd $(TEMP_PYTHON_DIR) \
&& ..\$(ZIP) \
-r ..\or-tools_python_examples_v$(OR_TOOLS_VERSION).zip \
ortools_examples
else
cd temp/ortools_examples && tar -C ../.. -c -v --exclude *svn* --exclude *roadef* --exclude *vector_packing* examples/data | tar xvm
cd temp && tar -c -v -z --no-same-owner -f ../or-tools_python_examples$(PYPI_OS)_v$(OR_TOOLS_VERSION).tar.gz ortools_examples
cd $(TEMP_PYTHON_DIR)/ortools_examples \
&& tar -C ../.. -c -v \
--exclude *svn* --exclude *roadef* --exclude *vector_packing* \
examples/data | tar xvm
cd $(TEMP_PYTHON_DIR) \
&& tar -c -v -z --no-same-owner \
-f ../or-tools_python_examples$(PYPI_OS)_v$(OR_TOOLS_VERSION).tar.gz \
ortools_examples
endif
-$(DELREC) $(TEMP_PYTHON_DIR)
#############
## DEBUG ##

View File

@@ -62,7 +62,7 @@ function export_manylinux_wheel {
make test_python
make pypi_archive
# Build and repair wheels
cd temp-python*/ortools
cd temp_python*/ortools
python setup.py bdist_wheel
cd dist
auditwheel repair ./*.whl -w "$export_root"

View File

@@ -107,7 +107,7 @@ echo -n "Test Python 2.7 wheel archive..." | tee -a build.log
make test_pypi_archive UNIX_PYTHON_VER=2.7
echo "DONE" | tee -a build.log
cp temp-python2.7/ortools/dist/*.whl .
cp temp_python2.7/ortools/dist/*.whl .
##################
## Python 3.7 ##
@@ -128,4 +128,4 @@ echo -n "Test Python 3.7 wheel archive..." | tee -a build.log
make test_pypi_archive UNIX_PYTHON_VER=3.7
echo "DONE" | tee -a build.log
cp temp-python3.7/ortools/dist/*.whl .
cp temp_python3.7/ortools/dist/*.whl .

View File

@@ -97,7 +97,7 @@ echo -n "Test Python 2 wheel archive..." | tee -a build.log
make test_pypi_archive UNIX_PYTHON_VER=2
echo "DONE" | tee -a build.log
cp temp-python2/ortools/dist/*.whl .
cp temp_python2/ortools/dist/*.whl .
################
## Python 3 ##
@@ -118,4 +118,4 @@ echo -n "Test Python 3 wheel archive..." | tee -a build.log
make test_pypi_archive UNIX_PYTHON_VER=3
echo "DONE" | tee -a build.log
cp temp-python3/ortools/dist/*.whl .
cp temp_python3/ortools/dist/*.whl .

View File

@@ -95,6 +95,7 @@ echo Test Python2.7 pypi archive... | tee.exe -a build.log
make.exe test_pypi_archive WINDOWS_PATH_TO_PYTHON=c:\python27-64 || exit 1
echo Test Python2.7 pypi archive...DONE | tee.exe -a build.log
set TEMP_DIR=temp_python27
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
REM ##################
@@ -115,6 +116,7 @@ echo Test Python3.5 pypi archive... | tee.exe -a build.log
make.exe test_pypi_archive WINDOWS_PATH_TO_PYTHON=c:\python35-64 || exit 1
echo Test Python3.5 pypi archive...DONE | tee.exe -a build.log
set TEMP_DIR=temp_python35
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
REM ##################
@@ -135,6 +137,7 @@ echo Test Python3.6 pypi archive... | tee.exe -a build.log
make.exe test_pypi_archive WINDOWS_PATH_TO_PYTHON=c:\python36-64 || exit 1
echo Test Python3.6 pypi archive...DONE | tee.exe -a build.log
set TEMP_DIR=temp_python36
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
REM ##################
@@ -155,4 +158,5 @@ echo Test Python3.7 pypi archive... | tee.exe -a build.log
make.exe test_pypi_archive WINDOWS_PATH_TO_PYTHON=c:\python37-64 || exit 1
echo Test Python3.7 pypi archive...DONE | tee.exe -a build.log
set TEMP_DIR=temp_python37
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .

View File

@@ -23,7 +23,7 @@ make pypi_archive UNIX_PYTHON_VER=2.7
echo Rebuild Python2.7 pypi archive...DONE | tee -a test.log
echo Creating Python2.7 venv... | tee -a test.log
TEMP_DIR=temp-python2.7
TEMP_DIR=temp_python2.7
VENV_DIR=${TEMP_DIR}/venv
python2.7 -m pip install --user virtualenv
python2.7 -m virtualenv ${VENV_DIR}
@@ -57,7 +57,7 @@ make pypi_archive UNIX_PYTHON_VER=3.7
echo Rebuild Python3.7 pypi archive...DONE | tee -a test.log
echo Creating Python3.7 venv... | tee -a test.log
TEMP_DIR=temp-python3.7
TEMP_DIR=temp_python3.7
VENV_DIR=${TEMP_DIR}/venv
python3.7 -m pip install --user virtualenv
python3.7 -m virtualenv ${VENV_DIR}

View File

@@ -23,7 +23,7 @@ make pypi_archive UNIX_PYTHON_VER=2.7
echo Rebuild Python2.7 pypi archive...DONE | tee -a test.log
echo Creating Python2.7 venv... | tee -a test.log
TEMP_DIR=temp-python2.7
TEMP_DIR=temp_python2.7
VENV_DIR=${TEMP_DIR}/venv
python2 -m pip install --user virtualenv
python2 -m virtualenv ${VENV_DIR}
@@ -57,7 +57,7 @@ make pypi_archive UNIX_PYTHON_VER=3.5
echo Rebuild Python3.5 pypi archive...DONE | tee -a test.log
echo Creating Python3.5 venv... | tee -a test.log
TEMP_DIR=temp-python3.5
TEMP_DIR=temp_python3.5
VENV_DIR=${TEMP_DIR}/venv
python3 -m pip install --user virtualenv
python3 -m virtualenv ${VENV_DIR}

View File

@@ -40,7 +40,7 @@ echo Rebuild Python2.7 pypi archive...DONE | tee.exe -a test.log
echo Creating Python2.7 venv... | tee.exe -a test.log
set PATH=c:\python27-64;c:\python27-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp-python27
set TEMP_DIR=temp_python27
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python2.7 venv...DONE | tee.exe -a test.log
@@ -74,7 +74,7 @@ echo Rebuild Python3.5 pypi archive...DONE | tee.exe -a test.log
echo Creating Python3.5 venv... | tee.exe -a test.log
set PATH=c:\python35-64;c:\python35-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp-python35
set TEMP_DIR=temp_python35
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.5 venv...DONE | tee.exe -a test.log
@@ -108,7 +108,7 @@ echo Rebuild Python3.6 pypi archive...DONE | tee.exe -a test.log
echo Creating Python3.6 venv... | tee.exe -a test.log
set PATH=c:\python36-64;c:\python36-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp-python36
set TEMP_DIR=temp_python36
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.6 venv...DONE | tee.exe -a test.log
@@ -142,7 +142,7 @@ echo Rebuild Python3.7 pypi archive...DONE | tee.exe -a test.log
echo Creating Python3.7 venv... | tee.exe -a test.log
set PATH=c:\python37-64;c:\python37-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp-python37
set TEMP_DIR=temp_python37
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.7 venv...DONE | tee.exe -a test.log