forked from MadAnalysis/madanalysis5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathma5
executable file
·83 lines (70 loc) · 3 KB
/
ma5
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
################################################################################
#
# Copyright (C) 2012-2023 Jack Araz, Eric Conte & Benjamin Fuks
# The MadAnalysis development team, email: <ma5team@iphc.cnrs.fr>
#
# This file is part of MadAnalysis 5.
# Official website: <https://github.com/MadAnalysis/madanalysis5>
#
# MadAnalysis 5 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# MadAnalysis 5 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MadAnalysis 5. If not, see <http://www.gnu.org/licenses/>
#
################################################################################
################################################################################
# MAIN PROGRAM
################################################################################
"""
This is the main executable, a simple frontend to set up the PYTHONPATH
and call immediately the command line interface scripts
"""
import importlib.util
import os
import sys
# Checking if the correct release of Python is installed
if sys.version_info[0] != 3 or sys.version_info[1] <= 6:
sys.exit(
"Python release "
+ sys.version
+ " is detected.\n"
+ "MadAnalysis 5 works only with Python version 3.6 or more recent version.\n"
+ "Please upgrade your Python installation."
)
# Checking that the 'six' package is present
if not importlib.util.find_spec("six"):
sys.exit(
'The python "six" module is not found on your system and it is required for MadAnalysis 5 for '
+ "a question of Python 2/3 compatibility. Please install it with the following command:\n"
+ "pip install six"
)
# Getting the parent directory (ma5 root dir) of the script real path (bin)
ma5dir = os.path.split(os.path.dirname(os.path.realpath(__file__)))[0]
if not os.path.isdir(ma5dir):
sys.exit("Detected MadAnalysis 5 general folder is not correct:\n" + ma5dir)
os.environ["MA5_BASE"] = ma5dir
# Adding the MadAnalysis 5 folder to the current PYTHONPATH
# -> allowing to use MadAnalysis 5 python files
sys.path.insert(0, ma5dir)
# Adding the python service folder to the current PYTHONPATH
servicedir = ma5dir + "/tools/ReportGenerator/Services/"
servicedir = os.path.normpath(servicedir)
if not os.path.isdir(servicedir):
sys.exit("Detected MadAnalysis 5 service folder is not correct:\n" + ma5dir)
sys.path.insert(0, servicedir)
# Release version
# Do not touch it !!!!!
version = "1.10.14"
date = "2024/01/22"
# Loading the MadAnalysis session
import madanalysis.core.launcher
madanalysis.core.launcher.LaunchMA5(version, date, ma5dir)