|
| 1 | +# ***************************************************************************** |
| 2 | +# Copyright (c) 2019-2021, Intel Corporation All rights reserved. |
| 3 | +# |
| 4 | +# Redistribution and use in source and binary forms, with or without |
| 5 | +# modification, are permitted provided that the following conditions are met: |
| 6 | +# |
| 7 | +# Redistributions of source code must retain the above copyright notice, |
| 8 | +# this list of conditions and the following disclaimer. |
| 9 | +# |
| 10 | +# Redistributions in binary form must reproduce the above copyright notice, |
| 11 | +# this list of conditions and the following disclaimer in the documentation |
| 12 | +# and/or other materials provided with the distribution. |
| 13 | +# |
| 14 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 15 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 16 | +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 | +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
| 18 | +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 | +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 | +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 21 | +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 22 | +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 23 | +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 24 | +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | +# ***************************************************************************** |
| 26 | + |
| 27 | + |
| 28 | +import argparse |
| 29 | +import os |
| 30 | +import shutil |
| 31 | +import traceback |
| 32 | +import re |
| 33 | + |
| 34 | +from pathlib import Path |
| 35 | +from utilities import SDC_Build_Utilities |
| 36 | + |
| 37 | + |
| 38 | +def check_sdc_installed(sdc_utils, sdc_package): |
| 39 | + cmd_output = sdc_utils.get_command_output('conda list sdc') |
| 40 | + pattern = sdc_package.replace('=', r'\s+') |
| 41 | + return re.search(pattern, cmd_output) |
| 42 | + |
| 43 | + |
| 44 | +if __name__ == '__main__': |
| 45 | + parser = argparse.ArgumentParser() |
| 46 | + parser.add_argument('--python', default='3.7', choices=['3.6', '3.7', '3.8'], |
| 47 | + help='Python version, default = 3.7') |
| 48 | + parser.add_argument('--channels', default=None, help='Default env channels') |
| 49 | + parser.add_argument('--sdc-channel', default=None, help='Intel SDC channel') |
| 50 | + |
| 51 | + args = parser.parse_args() |
| 52 | + |
| 53 | + sdc_utils = SDC_Build_Utilities(args.python, args.channels, args.sdc_channel) |
| 54 | + sdc_utils.log_info('Test Intel(R) SDC conda install', separate=True) |
| 55 | + sdc_utils.log_info(sdc_utils.line_double) |
| 56 | + sdc_utils.create_environment() |
| 57 | + sdc_package = f'sdc={sdc_utils.get_sdc_version_from_channel()}' |
| 58 | + |
| 59 | + # channels list is aligned with install instruction in README.rst |
| 60 | + install_channels = "-c intel/label/beta -c intel -c defaults -c conda-forge" |
| 61 | + sdc_utils.install_conda_package([sdc_package], channels=install_channels) |
| 62 | + |
| 63 | + assert check_sdc_installed(sdc_utils, sdc_package), "SDC package was not installed" |
0 commit comments