|
1 | | -#! /usr/bin/env python |
2 | | -# =============================================================================== |
3 | | -# Copyright 2023 Intel Corporation |
4 | | -# |
5 | | -# Licensed under the Apache License, Version 2.0 (the "License"); |
6 | | -# you may not use this file except in compliance with the License. |
7 | | -# You may obtain a copy of the License at |
8 | | -# |
9 | | -# http://www.apache.org/licenses/LICENSE-2.0 |
10 | | -# |
11 | | -# Unless required by applicable law or agreed to in writing, software |
12 | | -# distributed under the License is distributed on an "AS IS" BASIS, |
13 | | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
14 | | -# See the License for the specific language governing permissions and |
15 | | -# limitations under the License. |
16 | | -# =============================================================================== |
17 | | -from sys import argv, exit, stderr |
18 | | -from sys import version_info as python_version |
19 | | - |
20 | | -if len(argv) == 1: |
21 | | - from daal4py.sklearn._utils import sklearn_check_version |
22 | | -else: |
23 | | - # This is necessary to prevent import errors from sklearnex and by extension |
24 | | - # sklearn caused by initial scipy and/or numpy versions that are installed. |
25 | | - # It is written in a way to be `packaging` independent. This branch occurs |
26 | | - # when a sklearn version is given to the script externally. |
27 | | - def sklearn_check_version(ver): |
28 | | - ver = [int(i) if i != "" else 0 for i in ver.split(".")[:2]] |
29 | | - sk_ver = [int(i) if i != "" else 0 for i in str(argv[1]).split(".")[:2]] |
30 | | - return sk_ver[0] > ver[0] or (sk_ver[0] == ver[0] and sk_ver[1] >= ver[1]) |
31 | | - |
32 | | - |
33 | | -if sklearn_check_version("1.4"): |
34 | | - print("Scipy version is not specified for this sklearn/python version.", file=stderr) |
35 | | - print("scipy") |
36 | | -elif sklearn_check_version("1.3") or python_version[1] > 11: |
37 | | - if python_version[1] > 8: |
38 | | - print("scipy==1.12.*") |
39 | | - else: |
40 | | - print("scipy==1.11.*") |
41 | | -elif sklearn_check_version("1.2") or python_version[1] > 10: |
42 | | - if python_version[1] > 9: |
43 | | - print("scipy==1.12.*") |
44 | | - else: |
45 | | - print("scipy==1.9.*") |
46 | | -elif sklearn_check_version("1.1"): |
47 | | - print("scipy==1.8.*") |
48 | | -elif sklearn_check_version("1.0"): |
49 | | - print("scipy==1.7.*") |
50 | | -else: |
51 | | - print( |
52 | | - "Scipy version defaults to not specified " |
53 | | - "for this outdated sklearn/python version.", |
54 | | - file=stderr, |
55 | | - ) |
56 | | - print("scipy") |
| 1 | +#! /usr/bin/env python |
| 2 | +# =============================================================================== |
| 3 | +# Copyright 2023 Intel Corporation |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# =============================================================================== |
| 17 | +from sys import argv, exit, stderr |
| 18 | +from sys import version_info as python_version |
| 19 | + |
| 20 | +if len(argv) == 1: |
| 21 | + from daal4py.sklearn._utils import sklearn_check_version |
| 22 | +else: |
| 23 | + # This is necessary to prevent import errors from sklearnex and by extension |
| 24 | + # sklearn caused by initial scipy and/or numpy versions that are installed. |
| 25 | + # It is written in a way to be `packaging` independent. This branch occurs |
| 26 | + # when a sklearn version is given to the script externally. |
| 27 | + def sklearn_check_version(ver): |
| 28 | + ver = [int(i) if i != "" else 0 for i in ver.split(".")[:2]] |
| 29 | + sk_ver = [int(i) if i != "" else 0 for i in str(argv[1]).split(".")[:2]] |
| 30 | + return sk_ver[0] > ver[0] or (sk_ver[0] == ver[0] and sk_ver[1] >= ver[1]) |
| 31 | + |
| 32 | + |
| 33 | +if sklearn_check_version("1.4"): |
| 34 | + print("Scipy version is not specified for this sklearn/python version.", file=stderr) |
| 35 | + print("scipy") |
| 36 | +elif sklearn_check_version("1.0"): |
| 37 | + print("scipy==1.10.*") |
| 38 | +else: |
| 39 | + print( |
| 40 | + "Scipy version defaults to not specified " |
| 41 | + "for this outdated sklearn/python version.", |
| 42 | + file=stderr, |
| 43 | + ) |
| 44 | + print("scipy") |
0 commit comments