File: find_pkg.py

package info (click to toggle)
bornagain 23.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,948 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (21 lines) | stat: -rwxr-xr-x 431 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python3

# A BornAgain auxiliary script.
# License: Public Domain.

# Checks whether a given Python3 module is installed.
#
# Takes module name as argument.
# Returns 0 if module can be imported. Otherwise returns 1.

import sys

pkg = sys.argv[1]
try:
    __import__(pkg)
except:
    print("     find_pkg.py: package", pkg, "not found")
    sys.exit(1)

print("     find_pkg.py: package", pkg, "found")
sys.exit(0)