Author: johannes
Date: 2007-12-14 02:38:05 -0600 (Fri, 14 Dec 2007)
New Revision: 9845
Modified:
trunk/gnue-common/setup.py
Log:
Do not create a gnue.pth and paths.py in a dry-run
Modified: trunk/gnue-common/setup.py
===================================================================
--- trunk/gnue-common/setup.py 2007-12-07 15:00:56 UTC (rev 9844)
+++ trunk/gnue-common/setup.py 2007-12-14 08:38:05 UTC (rev 9845)
@@ -274,6 +274,7 @@
build_svnrev(os.path.join(self.build_lib, 'gnue', 'common',
'svnrev.py'))
+
# =============================================================================
# install: New option, generate path dependent files
# =============================================================================
@@ -353,59 +354,72 @@
# where to install gnue.pth
site_dir = get_python_lib()
if self.root:
- # add --root to target directory for gnue.py
+ # add --root to target directory for gnue.py
site_dir = change_root(self.root, site_dir)
# especially if we have --root, the directory might not exist
if not os.path.isdir(site_dir):
- os.makedirs(site_dir)
+ self.mkpath(site_dir)
# now create the file
- file = os.path.join(site_dir, "gnue.pth")
- log.info("trying to create %s" % file)
+ fname = os.path.join(site_dir, "gnue.pth")
+ log.info("trying to create %s" % fname)
try:
- output = open(file, "w")
- output.write(self.__quote(self.install_lib))
- output.close()
- # It worked. Turn off error message about installing into
- # directory not in path.
- sys.path.append(self.install_lib)
+ if not self.dry_run:
+ output = open(fname, "w")
+ output.write(self.__quote(self.install_lib))
+ output.close()
+ # It worked. Turn off error message about installing into
+ # directory not in path.
+ sys.path.append(self.install_lib)
+
# Record file
- self.__outputs.append(file)
+ self.__outputs.append(fname)
+
except:
pass
+
# -------------------------------------------------------------------------
# Create paths.py
# -------------------------------------------------------------------------
def __write_paths_py(self):
- dir = os.path.join(self.install_lib, "gnue")
- if not os.path.isdir(dir):
- os.makedirs(dir)
- file = os.path.join(dir, "paths.py")
- log.info("creating %s" % file)
- output = open(file, "w")
- output.write("# This file was generated during installation.\n")
- output.write("import os, sys\n")
- output.write("\n")
- output.write("lib = \"%s\"\n" % self.__quote(self.install_lib))
- output.write("scripts = \"%s\"\n" % self.__quote(self.install_scripts))
- output.write("\n")
- output.write("############################\n")
- output.write("# This is a workaround for McMillan packaging!!!\n")
- output.write("# McMillan sets sys.frozen=1 in packaged exe file.\n")
- output.write("############################\n")
- output.write("if hasattr(sys, 'frozen') and sys.platform == 'win32':\n")
- output.write(" data = os.path.dirname(os.path.dirname(sys.argv[0]))\n")
- output.write(" config = os.path.join(data, 'etc')\n")
- output.write("else:\n")
- output.write(" data = \"%s\"\n" % self.__quote(self.install_data))
- output.write(" config = \"%s\"\n" % self.__quote(self.install_config))
- output.close()
+
+ path = os.path.join(self.install_lib, "gnue")
+ self.mkpath(path)
+
+ fname = os.path.join(path, "paths.py")
+ log.info("creating %s" % fname)
+ if not self.dry_run:
+ output = open(fname, "w")
+ output.write("# This file was generated during installation.\n")
+ output.write("import os, sys\n")
+ output.write("\n")
+ output.write("lib = \"%s\"\n" % self.__quote(self.install_lib))
+ output.write("scripts = \"%s\"\n" % \
+ self.__quote(self.install_scripts))
+ output.write("\n")
+ output.write("############################\n")
+ output.write("# This is a workaround for McMillan packaging!!!\n")
+ output.write("# McMillan sets sys.frozen=1 in packaged exe file.\n")
+ output.write("############################\n")
+ output.write("if hasattr(sys, 'frozen') and sys.platform == " \
+ "'win32':\n")
+ output.write(" data = os.path.dirname(os.path.dirname(" \
+ "sys.argv[0]))\n")
+ output.write(" config = os.path.join(data, 'etc')\n")
+ output.write("else:\n")
+ output.write(" data = \"%s\"\n" % \
+ self.__quote(self.install_data))
+ output.write(" config = \"%s\"\n" % \
+ self.__quote(self.install_config))
+ output.close()
+
# Record file
- self.__outputs.append(file)
+ self.__outputs.append(fname)
+
# -------------------------------------------------------------------------
# Install translations by copying the files to the correct location
# -------------------------------------------------------------------------
@@ -425,6 +439,7 @@
# Record file
self.__outputs.append(dst)
+
# -------------------------------------------------------------------------
# install.run: generate and install path dependent files
# -------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.