eric6/Utilities/PySideImporter.py

Mon, 15 Apr 2019 19:53:29 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 15 Apr 2019 19:53:29 +0200
branch
setup.py
changeset 6949
a5255f1ba3f0
parent 6942
2602857055c5
child 7360
9190402e4505
permissions
-rw-r--r--

setup.py: continued implementing support for setup.py.

1142
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
6645
ad476851d7e0 Updated copyright for 2019.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6291
diff changeset
3 # Copyright (c) 2011 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
1142
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
7 Module to check for the presence of PySide/PySide2 by importing it.
1142
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import sys
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 if __name__ == "__main__":
6291
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
13 pySideVariant = "2"
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
14 if len(sys.argv) == 2:
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
15 pySideVariant = sys.argv[1].replace("-", "")
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
16
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
17 if pySideVariant == "1":
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
18 try:
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
19 import PySide # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
20 ret = 0
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
21 except ImportError:
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
22 ret = 1
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
23
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
24 elif pySideVariant == "2":
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
25 try:
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
26 import PySide2 # __IGNORE_EXCEPTION__ __IGNORE_WARNING__
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
27 ret = 0
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
28 except ImportError:
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
29 ret = 1
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
30
94e0e688dcad PySide2 support: started to implement support for PySide2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
31 else:
1142
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 ret = 1
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 sys.exit(ret)
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
01ae8e2946d3 Improved the code to detect PySide.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 #
4555
861e1741985c Adjustments to future imports for Python 2 compatibility.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 4543
diff changeset
37 # eflag: noqa = M702

eric ide

mercurial