swc-windows-installer.py: Only create the python-scripts dir if it doesn't exist
authorW. Trevor King <wking@tremily.us>
Tue, 12 Nov 2013 18:05:08 +0000 (10:05 -0800)
committerW. Trevor King <wking@tremily.us>
Tue, 12 Nov 2013 18:05:08 +0000 (10:05 -0800)
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."

swc-windows-installer.py

index 1904bbb89a844c8c967db12f763e26e1a3d55e26..3d2a790e8e7152ec372f97c9a6482b52ef86485c 100755 (executable)
@@ -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)