3
3
import argparse
4
4
from joblib import Parallel , delayed
5
5
6
- def pre_process_toml (args ):
7
- """
8
- Pre-process the fpm.toml
9
- """
10
- from tomlkit import table , dumps
11
- data = table ()
12
- data .add ("name" , "stdlib" )
13
- data .add ("version" , str (args .vmajor )+
14
- "." + str (args .vminor )+
15
- "." + str (args .vpatch ) )
16
- data .add ("license" , "MIT" )
17
- data .add ("author" , "stdlib contributors" )
18
- data .add ("maintainer" , "@fortran-lang/stdlib" )
19
- data .add ("copyright" , "2019-2021 stdlib contributors" )
20
-
21
- if (args .with_blp ):
22
- build = table ()
23
- build .add ("link" , ["lapack" , "blas" ] )
24
- data .add ("build" , build )
25
-
26
- dev_dependencies = table ()
27
- dev_dependencies .add ("test-drive" , {"git" : "https://github.com/fortran-lang/test-drive" ,
28
- "tag" : "v0.4.0" })
29
- data .add ("dev-dependencies" , dev_dependencies )
30
-
31
- preprocess = table ()
32
- preprocess .add ("cpp" , {} )
33
- preprocess ['cpp' ].add ("suffixes" , [".F90" , ".f90" ] )
34
- preprocess ['cpp' ].add ("macros" , ["MAXRANK=" + str (args .maxrank )] )
35
- data .add ("preprocess" , preprocess )
36
-
37
- if args .destdir == 'stdlib-fpm' :
38
- if not os .path .exists ('stdlib-fpm' ):
39
- os .makedirs ('stdlib-fpm' )
40
- name = 'stdlib-fpm' + os .sep + 'fpm.toml'
41
- else :
42
- name = "fpm.toml"
43
- with open (name , "w" ) as f :
44
- f .write (dumps (data ))
45
- return
46
-
47
6
C_PREPROCESSED = (
48
7
"stdlib_linalg_constants" ,
49
8
"stdlib_linalg_blas" ,
@@ -127,7 +86,6 @@ def fpm_build(args,unknown):
127
86
flags = flags + unknown [idx + 1 ]
128
87
#==========================================
129
88
# build with fpm
130
- os .chdir (args .destdir )
131
89
subprocess .run (["fpm build" ]+
132
90
[" --compiler " ]+ [FPM_FC ]+
133
91
[" --c-compiler " ]+ [FPM_CC ]+
@@ -147,9 +105,7 @@ def fpm_build(args,unknown):
147
105
parser .add_argument ("--with_qp" ,type = bool , default = False , help = "Include WITH_QP in the command" )
148
106
parser .add_argument ("--with_xdp" ,type = bool , default = False , help = "Include WITH_XDP in the command" )
149
107
150
- parser .add_argument ('--destdir' , action = 'store' , type = str , default = 'stdlib-fpm' , help = 'destination directory for the fypp preprocessing.' )
151
108
# external libraries arguments
152
- parser .add_argument ("--with_blp" ,type = bool , default = False , help = "Link against OpenBLAS" )
153
109
parser .add_argument ("--build" ,type = bool , default = False , help = "Build the project" )
154
110
155
111
args , unknown = parser .parse_known_args ()
@@ -158,12 +114,9 @@ def fpm_build(args,unknown):
158
114
with open ('VERSION' , 'r' ) as file :
159
115
version = file .read ().split ("." )
160
116
vmajor , vminor , vpatch = [int (value ) for value in version ]
161
- import tomlkit
162
- with open ('fpm.toml' , 'r' ) as file :
163
- manifest = tomlkit .parse (file .read ())
164
- #==========================================
165
- # pre process the fpm manifest
166
- # pre_process_toml(args)
117
+ args .vmajor = max (vmajor ,args .vmajor )
118
+ args .vminor = max (vminor ,args .vminor )
119
+ args .vpatch = max (vpatch ,args .vpatch )
167
120
#==========================================
168
121
# pre process the meta programming fypp files
169
122
pre_process_fypp (args )
0 commit comments