From: W. Trevor King Date: Tue, 12 Nov 2013 18:05:08 +0000 (-0800) Subject: swc-windows-installer.py: Only create the python-scripts dir if it doesn't exist X-Git-Tag: v0.1~22 X-Git-Url: http://git.tremily.us/?p=swc-setup-windows-installer.git;a=commitdiff_plain;h=c6691358526b7f77e1d23649c765d605b554fb93 swc-windows-installer.py: Only create the python-scripts dir if it doesn't exist os.makedirs, unlike 'mkdir -p', errors if the target directory already exists [1,2]. [1]: http://docs.python.org/2/library/os.html#os.makedirs "Raises an error exception if the leaf directory already exists or cannot be created" [2]: http://docs.python.org/3/library/os.html#os.makedirs "If exist_ok is False (the default), an OSError is raised if the target directory already exists." --- diff --git a/swc-windows-installer.py b/swc-windows-installer.py index 1904bbb..3d2a790 100755 --- a/swc-windows-installer.py +++ b/swc-windows-installer.py @@ -67,6 +67,8 @@ def create_nosetests_entry_point(python_scripts_directory): ' sys.exit(nose.core.main())', '', ]) + if not os.path.isdir(python_scripts_directory): + os.makedirs(python_scripts_directory) with open(os.path.join(python_scripts_directory, 'nosetests'), 'w') as f: f.write(contents)