234 |
self.install_config = os.path.join (self.install_data, "etc") |
self.install_config = os.path.join (self.install_data, "etc") |
235 |
|
|
236 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
|
# Build the commands to place into the scripts |
|
|
# --------------------------------------------------------------------------- |
|
|
|
|
|
def _build_gnue_env (self): |
|
|
if sys.platform != 'win32': |
|
|
gnue_env = "" |
|
|
else: |
|
|
# FIXME: Can this be moved into BaseApp.py ? |
|
|
# Or into the scripts ? |
|
|
gnue_env = \ |
|
|
"#######\n" \ |
|
|
+ "# The following variables were set when GNUe was installed\n" \ |
|
|
+ "# (Generated for a Win32 system)\n" \ |
|
|
+ "import os, sys\n" \ |
|
|
+ "if __name__ == '__main__': \n" \ |
|
|
+ " _BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'..'))\n" \ |
|
|
+ " try:\n" \ |
|
|
+ " os.environ['PATH']= os.path.abspath(os.path.dirname(sys.argv[0])) + ';' + os.environ['PATH']\n" \ |
|
|
+ " except KeyError:\n" \ |
|
|
+ " os.environ['PATH']= os.path.abspath(os.path.dirname(sys.argv[0]))\n" \ |
|
|
+ "else: \n" \ |
|
|
+ " _BASE = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))\n" \ |
|
|
+ "os.putenv('PYTHONCASEOK','1')\n" \ |
|
|
+ "if os.path.isdir(os.path.join(_BASE,'extras')):\n" \ |
|
|
+ " sys.path.append(os.path.join(_BASE,'extras'))\n" \ |
|
|
+ "#######\n\n" |
|
|
return gnue_env |
|
|
|
|
|
# --------------------------------------------------------------------------- |
|
|
# Generate the real scripts |
|
|
# --------------------------------------------------------------------------- |
|
|
|
|
|
def _generate_scripts (self): |
|
|
gnue_env = self._build_gnue_env () |
|
|
|
|
|
for script in self.distribution.scripts: |
|
|
print "building script %s" % script |
|
|
|
|
|
fin = open(script+".in", "r") |
|
|
fout = open(script, "w") |
|
|
|
|
|
lines = fin.readlines() |
|
|
|
|
|
for i in range(0, len(lines)): |
|
|
if string.strip(lines[i]) == "__GNUEENV__": |
|
|
lines[i] = gnue_env |
|
|
|
|
|
fout.writelines(lines) |
|
|
|
|
|
fin.close() |
|
|
fout.close() |
|
|
|
|
|
# --------------------------------------------------------------------------- |
|
237 |
# Quote a path: remove --root and duplicate backslashes |
# Quote a path: remove --root and duplicate backslashes |
238 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
239 |
|
|
301 |
def run (self): |
def run (self): |
302 |
check_dependencies () |
check_dependencies () |
303 |
|
|
|
# self._generate_scripts () |
|
|
|
|
304 |
self._write_gnue_pth () |
self._write_gnue_pth () |
305 |
|
|
306 |
self._write_paths_py () |
self._write_paths_py () |