aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-10-14 18:27:29 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2008-10-14 18:35:43 +0530
commit0041fc258421a446814351ed957e62563eed2db5 (patch)
tree2245b251ea65cd3045db1c4fcf7f02aed70423a4
parent[bugfix] Don't check gpghome while init_gpghome() (diff)
downloadautotua-0041fc258421a446814351ed957e62563eed2db5.tar.gz
autotua-0041fc258421a446814351ed957e62563eed2db5.tar.bz2
autotua-0041fc258421a446814351ed957e62563eed2db5.zip
[bugfix] Fix faulty detection of const.MASTER_DIR
Another testing-dependant bug. * Remove the current directory from the import path; we _really_ don't need it. The current directory takes priority for imports over the install dir. This causes ./master/const.py to be imported if ./setup-master.py is done, which results in a faulty detection of MASTER_DIR.
-rwxr-xr-xmaster/setup-master.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/master/setup-master.py b/master/setup-master.py
index 6608bb1..f10454f 100755
--- a/master/setup-master.py
+++ b/master/setup-master.py
@@ -14,6 +14,8 @@ except ImportError:
print "You need to install django-1.0 first."
sys.exit(1)
+# Remove current directory from search path
+sys.path = sys.path[1:]
# XXX: Document this in the help
if os.environ.has_key('PYTHONPATH'):
sys.path.insert(0, os.environ['PYTHONPATH'])
@@ -51,24 +53,24 @@ def install_master():
management.call_command('startproject', DESTDIR)
if SYMLINKS:
- os.symlink(cwd+'/master', DESTDIR+'/master')
+ os.symlink(srcdir+'/master', DESTDIR+'/master')
for file in ['urls.py']:
dest_file = DESTDIR+'/'+file
if os.path.isfile(dest_file):
os.remove(dest_file)
- os.symlink(cwd+'/custom/'+file, dest_file)
+ os.symlink(srcdir+'/custom/'+file, dest_file)
else:
- shutil.copytree(cwd+'/master', DESTDIR+'/master')
+ shutil.copytree(srcdir+'/master', DESTDIR+'/master')
for file in ['urls.py']:
- shutil.copy(cwd+'/custom/'+file, DESTDIR)
+ shutil.copy(srcdir+'/custom/'+file, DESTDIR)
settings = open(DESTDIR+'/settings.py', 'a')
- master_settings = open(cwd+'/custom/merge_settings.py')
+ master_settings = open(srcdir+'/custom/merge_settings.py')
settings.write('\n'+master_settings.read())
settings.close()
master_settings.close()
# Install icons
- icondir = os.path.abspath(cwd+'/icons')
+ icondir = os.path.abspath(srcdir+'/icons')
installdir = os.path.abspath(DESTDIR)
subprocess.check_call('cd %s; make DESTDIR=%s install' % (icondir, installdir), shell=True)
@@ -114,6 +116,8 @@ def syncdb_master():
def setup_gpg():
from autotua import crypt
from master import const
+ if not os.path.isdir(const.GPGHOME):
+ os.mkdir(const.GPGHOME, 0700)
data = {'name': 'AutotuA Master',
'email': 'autotua@localhost',
'expire': '1m'}
@@ -140,8 +144,11 @@ if len(sys.argv) < 3:
print_help()
sys.exit(1)
+# cd to setup-master.py location
os.chdir(os.path.dirname(sys.argv[0]))
-cwd = os.getcwd()
+# Store the current directory
+# We cd and store to work around relative invocations
+srcdir = os.getcwd()
if not os.path.isdir(sys.argv[2]):
os.makedirs(sys.argv[2])
os.chdir(sys.argv[2])
@@ -151,7 +158,8 @@ if management.get_version() < '0.99':
sys.exit(1)
sys.path.append(os.getcwd())
-sys.path.append(cwd+'/custom')
+# Add cwd+/custom
+sys.path.append(srcdir+'/custom')
if sys.argv[1] == 'install':
install_master()