2
2
# only if building in place: ``python setup.py build_ext --inplace``
3
3
import os
4
4
import re
5
+ import platform
5
6
import shutil
6
7
import setuptools
7
8
import subprocess
8
9
9
10
10
- def run_meson_build ():
11
+ def run_meson_build (staging_dir ):
11
12
prefix = os .path .join (os .getcwd (), staging_dir )
12
13
purelibdir = "."
13
14
@@ -16,6 +17,12 @@ def run_meson_build():
16
17
if "MESON_ARGS" in os .environ :
17
18
meson_args = os .environ ["MESON_ARGS" ]
18
19
20
+ if platform .system () == "Windows" :
21
+ if not "FC" in os .environ :
22
+ os .environ ["FC" ] = "gfortran"
23
+ if not "CC" in os .environ :
24
+ os .environ ["CC" ] = "gcc"
25
+
19
26
# configure
20
27
meson_path = shutil .which ("meson" )
21
28
meson_call = (
@@ -24,7 +31,9 @@ def run_meson_build():
24
31
)
25
32
sysargs = meson_call .split (" " )
26
33
sysargs = [arg for arg in sysargs if arg != "" ]
34
+ print (sysargs )
27
35
p1 = subprocess .run (sysargs , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
36
+ os .makedirs (staging_dir , exist_ok = True )
28
37
setup_log = os .path .join (staging_dir , "setup.log" )
29
38
with open (setup_log , "wb" ) as f :
30
39
f .write (p1 .stdout )
@@ -36,6 +45,8 @@ def run_meson_build():
36
45
# build
37
46
meson_call = f"{ meson_path } compile -vC { staging_dir } "
38
47
sysargs = meson_call .split (" " )
48
+ sysargs = [arg for arg in sysargs if arg != "" ]
49
+ print (sysargs )
39
50
p2 = subprocess .run (sysargs , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
40
51
compile_log = os .path .join (staging_dir , "compile.log" )
41
52
with open (compile_log , "wb" ) as f :
@@ -70,9 +81,9 @@ def copy_shared_libraries():
70
81
staging_dir = "meson_build"
71
82
72
83
# this keeps the meson build system from running more than once
73
- if "dist" not in str (os .path .abspath (__file__ )) and not os . path . isdir ( staging_dir ) :
84
+ if "dist" not in str (os .path .abspath (__file__ )):
74
85
cwd = os .getcwd ()
75
- run_meson_build ()
86
+ run_meson_build (staging_dir )
76
87
os .chdir (cwd )
77
88
copy_shared_libraries ()
78
89
@@ -101,8 +112,9 @@ def copy_shared_libraries():
101
112
extras_require = {
102
113
"testing" : ["pytest" ],
103
114
},
104
- python_requires = ">=3.7 " ,
115
+ python_requires = ">=3.8 " ,
105
116
packages = ["pyframe3dd" ],
117
+ package_data = {"" : ["*.yaml" , "*.so" , "*.lib" , "*.pyd" , "*.pdb" , "*.dylib" , "*.dll" ]},
106
118
license = 'Apache License, Version 2.0' ,
107
119
zip_safe = False ,
108
120
)
0 commit comments