Commits

mitsuhiko  committed e88cfdd

Fixed bugs in new installer.

  • Participants
  • Parent commits 7eae2cb

Comments (0)

Files changed (2)

 all:
 
 install:
-	@($(PYTHON) scripts/install-posix $(PREFIX))
+	@($(PYTHON) scripts/_install-posix.py $(PREFIX))
 
 uninstall:
 	@(PREFIX=$(PREFIX) /bin/sh ./scripts/_uninstall-posix.sh)

File scripts/_install-posix.py

 """
 import sys
 import os
+import shutil
 from subprocess import call as run
-from glob import glob
 
 
 join = os.path.join
 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)
                                     '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:
 
 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')
     # 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))
 
 
 
 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])