forked from MAteRialMOdelingToolbox/Marmot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
projectmanager.py
59 lines (48 loc) · 1.72 KB
/
projectmanager.py
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
#/* ---------------------------------------------------------------------
# * _
# * _ __ ___ __ _ _ __ _ __ ___ ___ | |_
# * | '_ ` _ \ / _` | '__| '_ ` _ \ / _ \| __|
# * | | | | | | (_| | | | | | | | | (_) | |_
# * |_| |_| |_|\__,_|_| |_| |_| |_|\___/ \__|
# *
# * Unit of Strength of Materials and Structural Analysis
# * University of Innsbruck,
# * 2020 - today
# *
# * festigkeitslehre@uibk.ac.at
# *
# * Matthias Neuner matthias.neuner@uibk.ac.at
# *
# * This file is part of the MAteRialMOdellingToolbox (marmot).
# *
# * This library is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation; either
# * version 2.1 of the License, or (at your option) any later version.
# *
# * The full text of the license can be found in the file LICENSE.md at
# * the top level directory of marmot.
# * ---------------------------------------------------------------------
# */
import os
import sys
import subprocess
def walk_modules(rootdir, levels=1):
rootdir = rootdir.rstrip(os.path.sep)
assert os.path.isdir(rootdir)
num_sep = rootdir.count(os.path.sep)
modules = []
for directory, subdirs, files in os.walk(rootdir):
num_sep_this = directory.count(os.path.sep)
if num_sep + levels <= num_sep_this:
continue
if 'module.cmake' in files:
modules.append (directory)
return modules
if __name__ == '__main__':
projects = ['.']
projects += walk_modules( './modules/', 3 )
for proj in projects:
print(proj)
p = subprocess.Popen(sys.argv[1:], cwd=proj)
p.wait()