@@ -164,7 +164,7 @@ def bundle_python_resources(
164
164
def write_folder_to_zipfile (zf , folder , prefix , path_filter = lambda file = None , dir = None : False ):
165
165
"""
166
166
Store a folder with Python modules. We do not store source code, instead,
167
- we for each py file we create a pyc entry rightaway. Any other resources in the
167
+ for each py file we create a pyc entry rightaway. Any other resources in the
168
168
folder are stored as-is. If data_only is given, neither .py nor .pyc files are
169
169
added to the archive.
170
170
"""
@@ -225,6 +225,13 @@ def build_binary(targetdir, jc, java_file, ni, parsed_args):
225
225
finally :
226
226
os .chdir (cwd )
227
227
228
+ def check_output_directory (parsed_args ):
229
+ if os .path .abspath (parsed_args .output_directory ).startswith (os .path .abspath (parsed_args .module )):
230
+ print (
231
+ "Output directory cannot be placed inside of module folder to run." ,
232
+ sep = "\n " ,
233
+ )
234
+ exit (1 )
228
235
229
236
def main (args ):
230
237
parser = argparse .ArgumentParser (prog = f"{ sys .executable } -m standalone" )
@@ -276,6 +283,10 @@ def main(args):
276
283
277
284
parsed_args = parser .parse_args (args )
278
285
286
+ preparing_java_project = hasattr (parsed_args , "output_directory" )
287
+ if preparing_java_project :
288
+ check_output_directory (parsed_args )
289
+
279
290
java_launcher_template = os .path .join (os .path .dirname (__file__ ), JAVA_LAUNCHER_FILE )
280
291
(
281
292
resource_zip ,
@@ -285,8 +296,6 @@ def main(args):
285
296
proj_prefix ,
286
297
) = parse_path_constants (java_launcher_template )
287
298
288
- preparing_java_project = hasattr (parsed_args , "output_directory" )
289
-
290
299
if preparing_java_project :
291
300
ni , jc = "" , ""
292
301
resource_prefix = os .path .join ("src" , "main" , "resources" )
0 commit comments