Permalink
Browse files

Fixed bugs in new installer.

  • Loading branch information...
1 parent b91f42f commit 15dcf4124084c6287728e9693e19e179e4457b16 mitsuhiko committed Dec 24, 2008
Showing with 18 additions and 10 deletions.
  1. +1 −1 Makefile.in
  2. +17 −9 scripts/_install-posix.py
View
@@ -7,7 +7,7 @@ PYTHON=%(PYTHON)s
all:
install:
- @($(PYTHON) scripts/install-posix $(PREFIX))
+ @($(PYTHON) scripts/_install-posix.py $(PREFIX))
uninstall:
@(PREFIX=$(PREFIX) /bin/sh ./scripts/_uninstall-posix.sh)
View
@@ -10,8 +10,8 @@
"""
import sys
import os
+import shutil
from subprocess import call as run
-from glob import glob
join = os.path.join
@@ -21,19 +21,26 @@
SCRIPTS = 'create-apache-config server shell'.split()
+def silent(f, *args):
+ try:
+ return f(*args)
+ except:
+ pass
+
+
def copy_folder(src, dst, recurse=True):
if recurse:
shutil.copytree(src, dst)
else:
- for filename in os.path.listdir(src):
- filename = join(src, dst)
+ for filename in os.listdir(src):
+ filename = join(src, filename)
if os.path.isfile(filename):
shutil.copy2(filename, dst)
def copy_servers(source, destination, lib_dir, python):
silent(os.makedirs, destination)
- for filename in os.path.listdir(source):
+ for filename in os.listdir(source):
f = file(join(source, filename))
try:
lines = list(f)
@@ -60,7 +67,7 @@ def copy_scripts(source, destination, lib_dir):
'ZINE_LIB = %r' % lib_dir)
finally:
f.close()
- f = file(join(destination, filename), 'w')
+ f = file(join(destination, '_init_zine.py'), 'w')
try:
f.write(contents)
finally:
@@ -71,7 +78,7 @@ def copy_scripts(source, destination, lib_dir):
def main(prefix):
python = sys.executable
- source = os.path.abspath('..')
+ source = os.path.abspath('.')
zine_source = join(source, 'zine')
lib_dir = join(prefix, 'lib', 'zine')
share_dir = join(prefix, 'share', 'zine')
@@ -86,7 +93,7 @@ def main(prefix):
# copy the packages and modules into the zine package
copy_folder(zine_source, join(lib_dir, 'zine'),
recurse=False)
- for package in packages:
+ for package in PACKAGES:
copy_folder(join(zine_source, package),
join(lib_dir, 'zine', package))
@@ -115,7 +122,8 @@ def main(prefix):
if __name__ == '__main__':
- if len(sys.args) != 2:
+ if len(sys.argv) != 2:
print >> sys.stderr, 'error: install script only accepts a prefix'
sys.exit(1)
- main(sys.args[1])
+ os.chdir(os.path.join(os.path.dirname(__file__), '..'))
+ main(sys.argv[1])

0 comments on commit 15dcf41

Please sign in to comment.