-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
23,368 additions
and
19,666 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,6 @@ rsconnect/ | |
|
||
# Intellij project directory | ||
.idea/ | ||
|
||
# Ant distribution directory | ||
dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 | ||
|
||
import xml.etree.ElementTree as ET | ||
import os | ||
import re | ||
import argparse | ||
|
||
from shutil import copyfile | ||
|
||
# Locate files starting at path, with filenames that match a regex | ||
def findfiles(path, regex): | ||
#print("regex: {}".format(regex)) | ||
regObj = re.compile(regex) | ||
res = [] | ||
for root, dirs, fnames in os.walk(path): | ||
for fname in fnames: | ||
#print("fname: {}".format(fname)) | ||
if regObj.match(fname): | ||
res.append(os.path.join(root, fname)) | ||
#print("root: {}, fname: {}".format(root, fname)) | ||
return res | ||
|
||
if __name__ == '__main__': | ||
|
||
parser = argparse.ArgumentParser(description='stage MetaDIG checks and suites.') | ||
parser.add_argument('src', metavar='N', type=str, nargs='+', | ||
help='source directory') | ||
parser.add_argument('dst', metavar='N', type=str, nargs='+', | ||
help='destination directory') | ||
parser.add_argument('suites', metavar='N', type=str, nargs='+', | ||
help='suites to stage') | ||
|
||
args = parser.parse_args() | ||
src = args.src[0] | ||
dst = args.dst[0] | ||
suites = args.suites[0].split(",") | ||
cwd = os.getcwd() | ||
|
||
print("source: {}".format(src)) | ||
print("destination: {}".format(dst)) | ||
print("suites: {}".format(suites)) | ||
|
||
for suite in suites: | ||
# Parse the next suite XML to and find all the checks listed | ||
print("processing suite: {}".format(suite)) | ||
copyfile("src/suites/{}".format(suite), "{}/suites/{}".format(dst, suite)) | ||
|
||
tree = ET.parse('src/suites/{}'.format(suite)) | ||
root = tree.getroot() | ||
|
||
# Loop through all '<check' elements in this suite XML file | ||
for check in root.findall('check'): | ||
# Get the <id> element from the check | ||
id = check.find('id').text | ||
print("id: {}".format(id)) | ||
|
||
#print findfiles('src/checks', "<id>\s*{}\s*</id>".format(id)) | ||
#print findfiles('./src/checks', "<id>\s*{}\s*</id>".format(id)) | ||
|
||
# Find all check files available | ||
checkFiles = findfiles('{}/checks'.format(src), "^.*xml$") | ||
#print checkFiles | ||
# for this id, search each check file to find the check file with this id | ||
for file in checkFiles: | ||
#print("file {}".format(file)) | ||
with open(file) as thisFile: | ||
if id in thisFile.read(): | ||
print('found check id {} in file {}'.format(id, file)) | ||
srcfile = "{}/{}".format(cwd, file) | ||
fname = os.path.basename(file) | ||
dstfile = "{}/{}/checks/{}".format(cwd, dst, fname) | ||
print("cp {} {}".format(srcfile, dstfile)) | ||
copyfile(srcfile, dstfile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Ant build properties files for the metadig-checks build | ||
|
||
# MetaDIG checks version | ||
metadig-checks.version=0.2.0 | ||
|
||
build=build | ||
dist=dist | ||
src=src | ||
bin=bin | ||
data=data | ||
# The script that reads suite XML files and copies all needed checks to dist | ||
stagescript=stageFiles.py | ||
# The suites to include in the distribution tar file | ||
#suites=arctic-data-center.xml,ess-dive.xml,FAIR-suite.xml,knb-suite.xml | ||
suites=FAIR-suite.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<project name="MetaDIG-checks" default="dist" basedir="."> | ||
<!-- This build file provides tasks to create distributions for the | ||
MetaDIG Quality Engine. | ||
Set properties in the file 'build.properties' to control the operation | ||
of the tasks | ||
--> | ||
<property file="build.properties" /> | ||
<description> | ||
MetaDIG Quality Engine Suites and Checks | ||
</description> | ||
<target name="init"> | ||
<!-- Create the time stamp --> | ||
<tstamp/> | ||
</target> | ||
<target name="dist" depends="init" | ||
description="generate the MetaDIG Checks distribution"> | ||
<!-- Create the distribution directory --> | ||
<mkdir dir="${dist}"/> | ||
<mkdir dir="${dist}/checks"/> | ||
<mkdir dir="${dist}/data"/> | ||
<mkdir dir="${dist}/suites"/> | ||
|
||
<copy todir="${dist}/data"> | ||
<fileset dir="${data}"> | ||
</fileset> | ||
</copy> | ||
|
||
<exec executable="${bin}/${stagescript}" spawn="false" output="stage.log"> | ||
<arg value="src"/> | ||
<arg value="dist"/> | ||
<arg value="${suites}"/> | ||
</exec> | ||
|
||
<tar destfile="${dist}/metadig-checks-${metadig-checks.version}.tar"> | ||
<tarfileset dir="${dist}/checks" | ||
prefix="checks" | ||
preserveLeadingSlashes="false"> | ||
<include name="*.xml"/> | ||
</tarfileset> | ||
<tarfileset dir="${dist}/suites" | ||
prefix="suites" | ||
preserveLeadingSlashes="false"> | ||
<include name="*.xml"/> | ||
</tarfileset> | ||
<tarfileset dir="${dist}/data" | ||
prefix="data" | ||
preserveLeadingSlashes="false"> | ||
<include name="*.*"/> | ||
</tarfileset> | ||
</tar> | ||
</target> | ||
|
||
<target name="clean" | ||
description="clean up"> | ||
<!-- Delete the ${build} and ${dist} directory trees --> | ||
<delete dir="${build}"/> | ||
<delete dir="${dist}"/> | ||
</target> | ||
</project> |
Oops, something went wrong.