|
@@ -0,0 +1,29 @@
|
|
|
+import os
|
|
|
+import subprocess
|
|
|
+from pathlib import Path
|
|
|
+import argparse
|
|
|
+
|
|
|
+parser = argparse.ArgumentParser(description="Convert pbrt 4 files of folder into another one")
|
|
|
+
|
|
|
+parser.add_argument('--previous', type=str, help='previous pbrt folder', required=True)
|
|
|
+parser.add_argument('--new', type=str, help='new pbrt folder (with all copy)', required=True)
|
|
|
+parser.add_argument('--pbrt', type=str, help='pbrt executable', required=True)
|
|
|
+
|
|
|
+args = parser.parse_args()
|
|
|
+
|
|
|
+p_previous = args.previous
|
|
|
+p_new = args.new
|
|
|
+p_pbrt = args.pbrt
|
|
|
+
|
|
|
+
|
|
|
+command = p_pbrt + " --upgrade {0} > {1}"
|
|
|
+
|
|
|
+os.system('cp -r {0} {1}'.format(p_previous, p_new))
|
|
|
+
|
|
|
+for path in Path(p_previous).rglob('*.pbrt'):
|
|
|
+ elements = str(path).split('/')
|
|
|
+ head = elements[0]
|
|
|
+ del elements[0]
|
|
|
+ print(path, '=>', p_new)
|
|
|
+ str_command = command.format(path, os.path.join(p_new, os.path.split(path)[-1]))
|
|
|
+ subprocess.call(str_command, shell=True)
|