Skip to content

Commit 5f5a058

Browse files
committed
focus on preprocessing and building
1 parent 9c363d8 commit 5f5a058

File tree

1 file changed

+3
-50
lines changed

1 file changed

+3
-50
lines changed

config/fypp_deployment.py

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,6 @@
33
import argparse
44
from joblib import Parallel, delayed
55

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-
476
C_PREPROCESSED = (
487
"stdlib_linalg_constants" ,
498
"stdlib_linalg_blas" ,
@@ -127,7 +86,6 @@ def fpm_build(args,unknown):
12786
flags= flags + unknown[idx+1]
12887
#==========================================
12988
# build with fpm
130-
os.chdir(args.destdir)
13189
subprocess.run(["fpm build"]+
13290
[" --compiler "]+[FPM_FC]+
13391
[" --c-compiler "]+[FPM_CC]+
@@ -147,9 +105,7 @@ def fpm_build(args,unknown):
147105
parser.add_argument("--with_qp",type=bool, default=False, help="Include WITH_QP in the command")
148106
parser.add_argument("--with_xdp",type=bool, default=False, help="Include WITH_XDP in the command")
149107

150-
parser.add_argument('--destdir', action='store', type=str, default='stdlib-fpm', help='destination directory for the fypp preprocessing.')
151108
# external libraries arguments
152-
parser.add_argument("--with_blp",type=bool, default=False, help="Link against OpenBLAS")
153109
parser.add_argument("--build",type=bool, default=False, help="Build the project")
154110

155111
args, unknown = parser.parse_known_args()
@@ -158,12 +114,9 @@ def fpm_build(args,unknown):
158114
with open('VERSION', 'r') as file:
159115
version = file.read().split(".")
160116
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)
167120
#==========================================
168121
# pre process the meta programming fypp files
169122
pre_process_fypp(args)

0 commit comments

Comments
 (0)