14 Définition des chemins pour compiler wxCppPy. 16 pyenv_path (str): Le chemin du répertoire de l'environement python. 17 pyenv_sp_path (str): Le chemin du répertoire «site-packages» dans l'environement python. 18 pyenv_include_path (str): Le chemin du répertoire «include/pythonx.yz» dans l'environement python. 19 pyenv_version (str): La version de python ex : 35m 20 pybind11_path (str): Le chemin du répertoire de pybind11. 21 wxpython_path (str): Le chemin du répertoire de wxpython. 22 cppclay_path (str): Le chemin du répertoire de cppclay.. 23 cppclaydll_path (str): Le chemin du répertoire des «.dll»/«.so» de cppclay. 26 ms_Filename =
'config.cfg' 29 wxcpppy_config = configparser.ConfigParser()
30 wxcpppy_config.read(WXCppPyConfig.ms_Filename)
32 py_version_short = sysconfig.get_config_var(
'py_version_short')
34 self.
pyenv_path = sysconfig.get_config_var(
'installed_base')
44 def get_extersion_suffix():
46 ext_suffix = sysconfig.get_config_var(
'EXT_SUFFIX')
47 if ext_suffix
is None:
48 ext_suffix = sysconfig.get_config_var(
'SO')
55 def __call__(self, parser, namespace, values, option_string=None):
56 prospective_dir = values
57 if not os.path.isdir(prospective_dir):
58 raise argparse.ArgumentTypeError(
"readable_dir:{0} is not a valid path".format(prospective_dir))
59 if os.access(prospective_dir, os.R_OK):
60 setattr(namespace, self.dest, prospective_dir)
62 raise argparse.ArgumentTypeError(
"readable_dir:{0} is not a readable dir".format(prospective_dir))
66 parser = argparse.ArgumentParser(description=
'Définition des chemins pour compiler wxCppPy.')
68 parser.add_argument(
'--pybind11_path', action=ReadableDir, required=
True,
69 help=
"Le chemin du répertoire de pybind11.")
71 parser.add_argument(
'--wxpython_path', action=ReadableDir, required=
True,
72 help=
"Le chemin du répertoire de wxpython.")
74 parser.add_argument(
'--cppclay_path', action=ReadableDir, required=
True,
75 help=
"Le chemin du répertoire de cppclay.")
77 parser.add_argument(
'--cppclaydll_path', action=ReadableDir, required=
True,
78 help=
"Le chemin du répertoire des «.dll»/«.so» de cppclay.")
80 args = parser.parse_args()
82 wxcpppy_config = configparser.ConfigParser()
84 wxcpppy_config[
'pybind11'] = {
'path': args.pybind11_path}
86 wxcpppy_config[
'wxpython'] = {
'path': args.wxpython_path}
88 wxcpppy_config[
'cppclay'] = {
'path': args.cppclay_path,
89 'dll_path': args.cppclaydll_path}
91 with open(WXCppPyConfig.ms_Filename,
'w')
as configfile:
92 wxcpppy_config.write(configfile)
95 if __name__ ==
"__main__":
100 print(
'============================================================================')
101 print(
'wxCppPy Config:')
102 print(
'pyenv_path : ' + config.pyenv_path)
103 print(
'pyenv_sp_path : ' + config.pyenv_sp_path)
104 print(
'pyenv_include_path : ' + config.pyenv_include_path)
105 print(
'pyenv_ext_suffix : ' + config.pyenv_ext_suffix)
106 print(
'pybind11_path : ' + config.pybind11_path)
107 print(
'wxpython_path : ' + config.wxpython_path)
108 print(
'cppclay_path : ' + config.cppclay_path)
109 print(
'cppclaydll_path : ' + config.cppclaydll_path)
110 print(
'============================================================================')