8
8
%define dist .el7
9
9
%endif
10
10
11
- %define name mssql-cli
12
- %define release 1%{?dist }
13
- %define time_stamp %(date +%y %m %d %H %M )
14
- %define base_version 1.0.0
15
- %define python_dir %{_builddir }/python_env
16
- %define python_url https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
17
- %define cli_lib_dir %{_libdir }/mssql-cli
18
- %define repo_path %{getenv:REPO_PATH }
19
- %define official_build %{getenv:MSSQL_CLI_OFFICIAL_BUILD }
11
+ %define name mssql-cli
12
+ %define release 1%{?dist }
13
+ %define time_stamp %(date +%y %m %d %H %M )
14
+ %define base_version 1.0.0
15
+ %define python_dir %{_builddir }/python_env
16
+ %define python_build_src /root/python_build_src
17
+ %define python_build /root/python_build
18
+ %define python_url https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
19
+ %define cli_lib_dir %{_libdir }/mssql-cli
20
+ %define repo_path %{getenv:REPO_PATH }
21
+ %define official_build %{getenv:MSSQL_CLI_OFFICIAL_BUILD }
20
22
21
23
# the ',,' makes environment variable lower case in Bash 4+
22
24
%if "%{official_build }" != "true"
@@ -48,10 +50,14 @@ Requires: libunwind, libicu, less
48
50
%prep
49
51
# Clean previous build directory.
50
52
rm -rf %{_builddir }/*
53
+ rm -rf %{python_build_src }
54
+
51
55
# Download, Extract Python3
56
+ mkdir %{python_build_src }
52
57
python_archive= $(mktemp)
53
58
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz -qO $python_archive
54
59
tar -xvzf $python_archive -C %{_builddir }
60
+ tar -xvzf $python_archive -C %{python_build_src }
55
61
56
62
%build
57
63
# clean any previous make files
@@ -62,15 +68,23 @@ make clean || echo "Nothing to clean"
62
68
make
63
69
make install
64
70
65
- # Install Python dependencies for build
71
+ # A copy of Python is created for build dependencies only
72
+ %{python_build_src }/*/configure --srcdir %{python_build_src }/* --prefix %{python_build }
73
+ make
74
+ make install
75
+
76
+ # Update pip
66
77
%{python_dir }/bin/pip3 install --upgrade pip
67
- %{python_dir }/bin/pip3 install -r %{ repo_path }/requirements-dev.txt
78
+ %{python_build }/bin/pip3 install --upgrade pip
68
79
69
- # Build mssql-cli wheel from source.
70
- export CUSTOM_PYTHON= %{python_dir }/bin/python3
71
- export CUSTOM_PIP= %{python_dir }/bin/pip3
80
+ # Install Python dependencies and build from source
81
+ export CUSTOM_PYTHON= %{python_build }/bin/python3
82
+ export CUSTOM_PIP= %{python_build }/bin/pip3
83
+ %{python_build }/bin/pip3 install -r %{repo_path }/requirements-dev.txt
84
+ %{python_build }/bin/python3 %{repo_path }/build.py build
72
85
73
- %{python_dir }/bin/python3 %{repo_path }/build.py build
86
+ # Remove python build version after build completes
87
+ rm -rf %{python_build }
74
88
75
89
%install
76
90
# Install mssql-cli
0 commit comments