@@ -81,13 +81,13 @@ def symlink_resource(src, resource_path):
81
81
os .remove (resource_path )
82
82
os .symlink (src , resource_path )
83
83
84
- def preprocess_resource (srcdir , resource_path , outdir ):
84
+ def preprocess_resource (resource_path ):
85
85
print ('Preprocessing' , resource_path , '...' )
86
86
resource_dir = os .path .dirname (resource_path )
87
87
if resource_dir != '' :
88
- os .makedirs (os .path .join (outdir , resource_dir ), exist_ok = True )
89
- srcpath = os .path .join (srcdir , resource_path )
90
- outpath = os .path .join (outdir , resource_path )
88
+ os .makedirs (os .path .join (OUT_DIR , resource_dir ), exist_ok = True )
89
+ srcpath = os .path .join (BASE_DIR , resource_path )
90
+ outpath = os .path .join (OUT_DIR , resource_path )
91
91
if os .path .exists (outpath ):
92
92
os .remove (outpath )
93
93
preprocessed_content , modified_line_count = get_preprocessed_resource (srcpath )
@@ -103,11 +103,11 @@ def copy_file(src_path, dst_path):
103
103
with open (dst_path , 'wb' ) as dst :
104
104
dst .write (src .read ())
105
105
106
- def preprocess_resources (resource_file_path , outdir ):
106
+ def preprocess_resources (resource_file_path ):
107
107
resource_filename = os .path .basename (resource_file_path )
108
108
for resource in read_resource_file (resource_file_path ):
109
- preprocess_resource (BASE_DIR , resource , outdir )
110
- copy_file (resource_file_path , os .path .join (outdir , resource_filename ))
109
+ preprocess_resource (resource )
110
+ copy_file (resource_file_path , os .path .join (OUT_DIR , resource_filename ))
111
111
112
112
if __name__ == "__main__" :
113
113
parser = argparse .ArgumentParser ()
@@ -118,8 +118,9 @@ if __name__ == "__main__":
118
118
parser .add_argument ('resource_file' )
119
119
args = parser .parse_args ()
120
120
BASE_DIR = os .path .dirname (os .path .realpath (args .resource_file ))
121
+ OUT_DIR = args .outdir
121
122
122
123
if args .list_all :
123
124
list_resources (args .resource_file )
124
125
elif args .preprocess :
125
- preprocess_resources (args .resource_file , args . outdir )
126
+ preprocess_resources (args .resource_file )
0 commit comments