File: configure

package info (click to toggle)
petsc 3.14.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 266,472 kB
  • sloc: ansic: 680,898; python: 33,303; cpp: 16,324; makefile: 14,022; f90: 13,731; javascript: 10,713; fortran: 9,581; sh: 1,373; xml: 619; objc: 445; csh: 192; pascal: 148; java: 13
file content (40 lines) | stat: -rwxr-xr-x 1,598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

"true" '''\'
for pyimpl in python3 python python2; do
  which $pyimpl > /dev/null 2>&1
  if [ $? -eq 0 ]; then
    $pyimpl -c "import distutils.sysconfig" > /dev/null 2>&1
    if [ $? -eq 0 ]; then
      echo "Using $pyimpl for Python" && exec $pyimpl "$0" "$@"
    else
      echo "$pyimpl is missing distutils.sysconfig, Skipping..."
    fi
  fi
done
echo "Error! Could not locate Python (with distutils.sysconfig)! Please install and have python3, python, or python2 (with distutils.sysconfig) in PATH."
echo "Or use: /path/to/valid/python configure $@"
exit 127
'''

import sys, os

if sys.version_info < (2,6) or (sys.version_info >= (3,0) and sys.version_info < (3,4)):
  print('************************************************************************')
  print('*      Python version 2.6+ or 3.4+ is required to run ./configure      *')
  print('*         Try: "python2.7 ./configure" or "python3 ./configure"        *')
  print('************************************************************************')
  sys.exit(4)

try:
  import distutils.sysconfig
except:
  print('************************************************************************')
  print('* '+sys.executable+' is missing "distutils.sysconfig" module! Its required to build PETSc **')
  print('* Try installing (for ex: on Ubuntu) "python3-distutils"  or equivalent package that is compatible with '+sys.executable+' ***')
  print('************************************************************************')
  sys.exit(4)

sys.path.insert(0, os.path.abspath('config'))
import configure
configure.petsc_configure([])