1111
1212import github3
1313
14-
1514# regex pattern in comments for requesting a docs build
1615PATTERN_DOCS_BUILD = r"\+DOCS"
1716# regex pattern in comments for requesting tests of specific submodules
@@ -30,7 +29,7 @@ def get_github_client(token=None):
3029 if token is None :
3130 msg = (
3231 "Could not get authorization token for ObsPy github API "
33- "(env variable OBSPY_COMMIT_STATUS_TOKEN )"
32+ "(env variable GITHUB_TOKEN )"
3433 )
3534 warnings .warn (msg )
3635 gh = github3 .GitHub ()
@@ -223,9 +222,9 @@ def get_commit_time(commit, fork="obspy", token=None):
223222 repo = gh .repository (fork , "obspy" )
224223 commit = repo .commit (commit )
225224 dt = datetime .datetime .strptime (
226- commit .commit . committer ["date" ], "%Y-%m-%dT%H:%M:%SZ"
225+ commit .commit [ " committer" ] ["date" ], "%Y-%m-%dT%H:%M:%SZ"
227226 )
228- return time . mktime ( dt .timetuple () )
227+ return dt .timestamp ( )
229228
230229
231230def get_issue_numbers_that_request_docs_build (verbose = False , token = None ):
@@ -460,17 +459,20 @@ def make_ci_json_config(issue_number, path="obspy_ci_conf.json", token=None):
460459 # comment string to use for later actions.
461460 module_list = get_module_test_list (issue_number , token = token )
462461 docs = check_docs_build_requested (issue_number , token = token )
462+ module_list_obspy_prepended = [f"obspy.{ x } " for x in module_list ]
463463
464464 out = dict (
465- module_list = ( "obspy." + ",obspy." ) .join (module_list ),
465+ module_list = "," .join (module_list_obspy_prepended ),
466466 module_list_spaces = " " .join (module_list ),
467467 docs = docs ,
468468 )
469469
470- # make sure path exists
471- path = Path (path )
472- path_dir = path if path .is_dir () else path .parent
473- path_dir .mkdir (exist_ok = True , parents = True )
470+ # Write output to file if path is not None
471+ if path is not None :
472+ path = Path (path )
473+ path_dir = path if path .is_dir () else path .parent
474+ path_dir .mkdir (exist_ok = True , parents = True )
475+ with path .open ("w" ) as fi :
476+ json .dump (out , fi , indent = 4 )
474477
475- with path .open ("w" ) as fi :
476- json .dump (out , fi , indent = 4 )
478+ return out
0 commit comments