Skip to content
Snippets Groups Projects
Commit bcd1bcbe authored by George Marchment's avatar George Marchment
Browse files

Update Ro-Crate Profile

parent 9f110efe
No related branches found
No related tags found
No related merge requests found
Pipeline #13150 passed with stage
in 37 seconds
...@@ -39,8 +39,8 @@ class RO_Crate: ...@@ -39,8 +39,8 @@ class RO_Crate:
root["name"] = self.workflow.get_name() root["name"] = self.workflow.get_name()
root["datePublished"] = self.workflow.get_datePublished() root["datePublished"] = self.workflow.get_datePublished()
root["description"] = self.workflow.get_description() root["description"] = self.workflow.get_description()
root["mainEntity"] = {"@id": self.workflow.get_main_file(), root["mainEntity"] = {"@id": self.workflow.get_main_file()}
"@type":["File", "SoftwareSourceCode"]} #We do not consider a File as a "ComputationalWorkflow" since multiple (sub)workflows can be defined in a same file #, "@type":["File", "SoftwareSourceCode"]} #We do not consider a File as a "ComputationalWorkflow" since multiple (sub)workflows can be defined in a same file
root["license"] = {"@id":self.workflow.get_license()} root["license"] = {"@id":self.workflow.get_license()}
authors = self.workflow.get_authors() authors = self.workflow.get_authors()
tab_authors = [] tab_authors = []
...@@ -77,7 +77,7 @@ class RO_Crate: ...@@ -77,7 +77,7 @@ class RO_Crate:
current_directory = os.getcwd() current_directory = os.getcwd()
os.chdir("/".join(self.workflow.nextflow_file.get_file_address().split("/")[:-1])) os.chdir("/".join(self.workflow.nextflow_file.get_file_address().split("/")[:-1]))
try: try:
os.system(f"git log {'--reverse'*reverse} {file} > temp_{id(self)}.txt >/dev/null 2>&1") os.system(f"git log {'--reverse'*reverse} {file} > temp_{id(self)}.txt")
with open(f'temp_{id(self)}.txt') as f: with open(f'temp_{id(self)}.txt') as f:
info = f.read() info = f.read()
os.system(f"rm temp_{id(self)}.txt") os.system(f"rm temp_{id(self)}.txt")
...@@ -153,6 +153,7 @@ class RO_Crate: ...@@ -153,6 +153,7 @@ class RO_Crate:
for file in self.files: for file in self.files:
self.initialise_file(file) self.initialise_file(file)
self.fill_from_workflow() self.fill_from_workflow()
self.dico.pop("temp_directory")
with open(f"{self.workflow.get_output_dir()}/ro-crate-metadata-{self.workflow.get_name()}.json", 'w') as output_file : with open(f"{self.workflow.get_output_dir()}/ro-crate-metadata-{self.workflow.get_name()}.json", 'w') as output_file :
json.dump(self.dico, output_file, indent=2) json.dump(self.dico, output_file, indent=2)
\ No newline at end of file
...@@ -37,7 +37,7 @@ class Workflow: ...@@ -37,7 +37,7 @@ class Workflow:
current_directory = os.getcwd() current_directory = os.getcwd()
os.chdir("/".join(self.nextflow_file.get_file_address().split("/")[:-1])) os.chdir("/".join(self.nextflow_file.get_file_address().split("/")[:-1]))
try: try:
os.system(f"git log --reverse > temp_{id(self)}.txt >/dev/null 2>&1") os.system(f"git log --reverse > temp_{id(self)}.txt")
with open(f'temp_{id(self)}.txt') as f: with open(f'temp_{id(self)}.txt') as f:
self.log = f.read() self.log = f.read()
os.system(f"rm temp_{id(self)}.txt") os.system(f"rm temp_{id(self)}.txt")
...@@ -52,7 +52,7 @@ class Workflow: ...@@ -52,7 +52,7 @@ class Workflow:
current_directory = os.getcwd() current_directory = os.getcwd()
os.chdir("/".join(self.nextflow_file.get_file_address().split("/")[:-1])) os.chdir("/".join(self.nextflow_file.get_file_address().split("/")[:-1]))
try: try:
os.system(f"git ls-remote --get-url origin > temp_address_{id(self)}.txt >/dev/null 2>&1") os.system(f"git ls-remote --get-url origin > temp_address_{id(self)}.txt")
with open(f'temp_address_{id(self)}.txt') as f: with open(f'temp_address_{id(self)}.txt') as f:
self.address = f.read() self.address = f.read()
os.system(f"rm temp_address_{id(self)}.txt") os.system(f"rm temp_address_{id(self)}.txt")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment