4343from utilities import set_environment_variable
4444
4545
46- def run_smoke_tests (sdc_src , test_env_activate ):
47- sdc_pi_example = os .path .join (sdc_src , 'buildscripts' , 'sdc_pi_example.py' )
48- run_command (f'{ test_env_activate } && python -c "import sdc"' )
49- run_command (f'{ test_env_activate } && python { sdc_pi_example } ' )
50-
51-
5246if __name__ == '__main__' :
5347 sdc_src = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
5448 sdc_recipe = os .path .join (sdc_src , 'buildscripts' , 'sdc-conda-recipe' )
@@ -62,15 +56,13 @@ def run_smoke_tests(sdc_src, test_env_activate):
6256
6357 # Parse input arguments
6458 parser = argparse .ArgumentParser ()
65- parser .add_argument ('--build-mode' , default = 'develop ' , choices = ['develop' , 'install' , 'package' ],
59+ parser .add_argument ('--build-mode' , default = 'package ' , choices = ['package' ],
6660 help = """Build mode:
67- develop: install package in source directory (default)
68- install: build and install package in build environment
69- package: build conda and wheel packages""" )
61+ package: build conda and wheel packages (default)""" )
7062 parser .add_argument ('--python' , default = '3.7' , choices = ['3.6' , '3.7' , '3.8' ],
7163 help = 'Python version to build with, default = 3.7' )
72- parser .add_argument ('--numpy' , default = '1.16 ' , choices = ['1.15' , '1.16' , '1.17' ],
73- help = 'Numpy version to build with, default = 1.16 ' )
64+ parser .add_argument ('--numpy' , default = '1.17 ' , choices = ['1.16' , '1.17' ],
65+ help = 'Numpy version to build with, default = 1.17 ' )
7466 parser .add_argument ('--output-folder' , default = os .path .join (sdc_src , 'sdc-build' ),
7567 help = 'Output folder for build packages, default = sdc-build' )
7668 parser .add_argument ('--conda-prefix' , default = None , help = 'Conda prefix' )
@@ -84,8 +76,6 @@ def run_smoke_tests(sdc_src, test_env_activate):
8476
8577 build_mode = args .build_mode
8678 python = args .python
87- if python == '3.7' :
88- python = '3.7.3'
8979 numpy = args .numpy
9080 output_folder = args .output_folder
9181 conda_prefix = os .getenv ('CONDA_PREFIX' , args .conda_prefix )
@@ -99,10 +89,8 @@ def run_smoke_tests(sdc_src, test_env_activate):
9989 conda_activate = get_conda_activate_cmd (conda_prefix ).replace ('"' , '' )
10090 build_env = f'sdc-build-env-py{ python } -numpy{ numpy } '
10191 test_env = f'sdc-test-env-py{ python } -numpy{ numpy } '
102- develop_env = f'sdc-develop-env-py{ python } -numpy{ numpy } '
10392 build_env_activate = get_activate_env_cmd (conda_activate , build_env )
10493 test_env_activate = get_activate_env_cmd (conda_activate , test_env )
105- develop_env_activate = get_activate_env_cmd (conda_activate , develop_env )
10694
10795 conda_channels = f'-c { numba_channel } -c defaults -c conda-forge --override-channels'
10896 # If numba is taken from custom channel, need to add numba channel to get dependencies
@@ -114,10 +102,6 @@ def run_smoke_tests(sdc_src, test_env_activate):
114102
115103 conda_build_packages = ['conda-build' ]
116104 if platform .system () == 'Windows' :
117- if build_mode != 'package' :
118- set_environment_variable ('INCLUDE' , os .path .join ('%CONDA_PREFIX%' , 'Library' , 'include' ))
119- set_environment_variable ('LIB' , os .path .join ('%CONDA_PREFIX%' , 'Library' , 'lib' ))
120-
121105 conda_build_packages .extend (['conda-verify' , 'vc' , 'vs2015_runtime' , 'vs2015_win-64' , 'pywin32=223' ])
122106
123107 # Build Numba from master
@@ -132,66 +116,16 @@ def run_smoke_tests(sdc_src, test_env_activate):
132116 f'{ numba_conda_channels } { numba_recipe } ' ])))
133117 format_print ('NUMBA BUILD COMPETED' )
134118
135- # Get sdc build and test environment
136- sdc_env = get_sdc_env (conda_activate , sdc_src , sdc_recipe , python , numpy , conda_channels )
137-
138119 # Set build command
139- if build_mode == 'package' :
140- create_conda_env (conda_activate , build_env , python , conda_build_packages )
141- build_cmd = '{} && {}' .format (build_env_activate ,
142- ' ' .join (['conda build --no-test' ,
143- f'--python { python } ' ,
144- f'--numpy { numpy } ' ,
145- f'--output-folder { output_folder } ' ,
146- f'{ conda_channels } { sdc_recipe } ' ]))
147- else :
148- create_conda_env (conda_activate , develop_env , python , sdc_env ['build' ], conda_channels )
149- build_cmd = f'{ develop_env_activate } && python setup.py { build_mode } '
120+ create_conda_env (conda_activate , build_env , python , conda_build_packages )
121+ build_cmd = '{} && {}' .format (build_env_activate ,
122+ ' ' .join (['conda build --no-test' ,
123+ f'--python { python } ' ,
124+ f'--numpy { numpy } ' ,
125+ f'--output-folder { output_folder } ' ,
126+ f'{ conda_channels } { sdc_recipe } ' ]))
150127
151128 # Start build
152129 format_print ('START SDC BUILD' )
153130 run_command (build_cmd )
154131 format_print ('BUILD COMPETED' )
155-
156- # Check if smoke tests should be skipped
157- if skip_smoke_tests is True :
158- format_print ('Smoke tests are skipped due to "--skip-smoke-tests" option' )
159- sys .exit (0 )
160-
161- # Start smoke tests
162- format_print ('Run Smoke tests' )
163- """
164- os.chdir(../sdc_src) is a workaround for the following error:
165- Traceback (most recent call last):
166- File "<string>", line 1, in <module>
167- File "sdc/sdc/__init__.py", line 9, in <module>
168- import sdc.dict_ext
169- File "sdc/sdc/dict_ext.py", line 12, in <module>
170- from sdc.str_ext import string_type, gen_unicode_to_std_str, gen_std_str_to_unicode
171- File "sdc/sdc/str_ext.py", line 18, in <module>
172- from . import hstr_ext
173- ImportError: cannot import name 'hstr_ext' from 'sdc' (sdc/sdc/__init__.py)
174- """
175- os .chdir (os .path .dirname (sdc_src ))
176-
177- if build_mode == 'package' :
178- # Get build packages
179- sdc_packages = get_sdc_build_packages (output_folder )
180- for package in sdc_packages :
181- if '.tar.bz2' in package :
182- # Start test for conda package
183- format_print (f'Run tests for sdc conda package: { package } ' )
184- create_conda_env (conda_activate , test_env , python , sdc_env ['test' ], conda_channels )
185- run_command (f'{ test_env_activate } && conda install -y { package } ' )
186- run_smoke_tests (sdc_src , test_env_activate )
187- elif '.whl' in package :
188- # Start test for wheel package
189- format_print (f'Run tests for sdc wheel package: { package } ' )
190- create_conda_env (conda_activate , test_env , python , sdc_env ['test' ] + ['pip' ], conda_channels )
191- run_command (f'{ test_env_activate } && pip install { package } ' )
192- run_smoke_tests (sdc_src , test_env_activate )
193- else :
194- format_print ('Run tests for installed sdc package' )
195- run_smoke_tests (sdc_src , develop_env_activate )
196-
197- format_print ('SMOKE TESTS ARE PASSED' )
0 commit comments