aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2013-09-14 20:54:06 -0400
committerRalph Sennhauser <sera@gentoo.org>2013-09-15 18:07:10 +0200
commit5088f91ab235fe85c881dcac2e87a1e828fc1752 (patch)
treea0958f827075503d08aae03050c53505989488ff
parentFix typo reported by Dessa in #gentoo-java (diff)
downloadjava-config-5088f91ab235fe85c881dcac2e87a1e828fc1752.tar.gz
java-config-5088f91ab235fe85c881dcac2e87a1e828fc1752.tar.bz2
java-config-5088f91ab235fe85c881dcac2e87a1e828fc1752.zip
Fixup directory and file installation code in jc_install
Use mkpath to prevent failure if the path already exists. Write data to a temp file and call copy_file to install to avoid a race condition if with concurrent build processes.
-rw-r--r--setup.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index ec54b37..7aff539 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@ from distutils.cmd import Command
from distutils.command.build import build
from distutils.command.install import install
from distutils.command.sdist import sdist
-import fileinput, os, subprocess, sys, unittest
+import fileinput, os, subprocess, sys, tempfile, unittest
class jc_build(build):
@@ -87,10 +87,13 @@ class jc_install(install):
elif arch in ['hpux']:
defaults = '*= hp-jdk-bin'
- os.mkdirs(self.root + '/usr/share/java-config-2/config/')
- with open(self.root + '/usr/share/java-config-2/config/jdk-defaults.conf', 'w') as f:
+ with tempfile.NamedTemporaryFile(mode='w', delete=False) as f:
f.write("# This files contain the default support jdk's\n")
f.write(defaults + "\n")
+ confdir = self.root + '/usr/share/java-config-2/config/'
+ self.mkpath(confdir)
+ self.copy_file(f.name, confdir + 'jdk-defaults.conf', preserve_mode=0)
+ os.remove(f.name)
class jc_sdist(sdist):