summaryrefslogtreecommitdiff
path: root/status
diff options
context:
space:
mode:
authorRene Rivera <grafikrobot@gmail.com>2016-07-07 11:00:05 -0500
committerRene Rivera <grafikrobot@gmail.com>2016-07-07 11:01:59 -0500
commitb4ff9817a881cfcd1d427807d329df8c8a0ee1f1 (patch)
treee3403c94d635bc5e1ecca465a7aacceab82b02c8 /status
parent8910a0aadfc897ee3341657fac8aba998b0748dc (diff)
downloadboost-b4ff9817a881cfcd1d427807d329df8c8a0ee1f1.tar.gz
Add support for parent lib meta data to include sublib meta data.
Diffstat (limited to 'status')
-rw-r--r--status/boost_check_library.py51
1 files changed, 48 insertions, 3 deletions
diff --git a/status/boost_check_library.py b/status/boost_check_library.py
index d32c911f7f..e75563936a 100644
--- a/status/boost_check_library.py
+++ b/status/boost_check_library.py
@@ -12,6 +12,7 @@ import optparse
import sys
import glob
import fnmatch
+import json
class check_library():
'''
@@ -83,7 +84,25 @@ class check_library():
'org-inc-one')
def check_organization_meta(self):
- if self.assert_dir_exists(os.path.join(self.library_dir,'meta'),
+ parent_dir = os.path.dirname(self.library_dir)
+ # If this is a sublibrary it's possible that the library information is the
+ # parent library's meta/libraries.json. Otherwise it's a regular library
+ # and structure.
+ if not self.test_dir_exists(os.path.join(self.library_dir,'meta')) \
+ and self.test_file_exists(os.path.join(parent_dir,'meta'),['libraries.json']):
+ if self.get_library_meta():
+ return
+ self.assert_file_exists(os.path.join(self.library_dir, 'meta'), ['libraries.json'],
+ '''
+ Did not find [project-root]/meta/libraries.json file, nor did
+ [super-project]/meta/libraries.json contain an entry for the sublibrary.
+
+ The file is required for all libraries. And contains information about
+ the library used to generate website and documentation for the
+ Boost C++ Libraries collection.
+ ''',
+ 'org-meta-libs')
+ elif self.assert_dir_exists(os.path.join(self.library_dir,'meta'),
'''
Missing [project-root]/meta directory. The [project-root]/meta directory
is required for all libraries.
@@ -140,7 +159,8 @@ class check_library():
self.library_dir = os.path.join(self.boost_root, self.library)
self.error_count = 0;
self.jamfile = self.jamfile.split(';')
- self.library_name = os.path.basename(self.library)
+ self.library_name = self.library.split('/',1)[1] #os.path.basename(self.library)
+ self.library_key = self.library.split('/',1)[1]
if self.debug:
print ">>> cwd: %s"%(os.getcwd())
@@ -158,7 +178,32 @@ class check_library():
for method in inspect.getmembers(self, predicate=inspect.ismethod):
if method[0].startswith(action_base):
getattr(self,method[0])(*args, **kargs)
-
+
+ def get_library_meta(self):
+ '''
+ Fetches the meta data for the current library. The data could be in
+ the superlib meta data file. If we can't find the data None is returned.
+ '''
+ parent_dir = os.path.dirname(self.library_dir)
+ if self.test_file_exists(os.path.join(self.library_dir,'meta'),['libraries.json']):
+ with open(os.path.join(self.library_dir,'meta','libraries.json'),'r') as f:
+ meta_data = json.load(f)
+ if isinstance(meta_data,list):
+ for lib in meta_data:
+ if lib['key'] == self.library_key:
+ return lib
+ elif 'key' in meta_data and meta_data['key'] == self.library_key:
+ return meta_data
+ if not self.test_dir_exists(os.path.join(self.library_dir,'meta')) \
+ and self.test_file_exists(os.path.join(parent_dir,'meta'),['libraries.json']):
+ with open(os.path.join(parent_dir,'meta','libraries.json'),'r') as f:
+ libraries_json = json.load(f)
+ if isinstance(libraries_json,list):
+ for lib in libraries_json:
+ if lib['key'] == self.library_key:
+ return lib
+ return None
+
def error(self, reason, message, key):
self.error_count += 1
print("%s: error: %s; %s <<%s>>"%(