]> git.donarmstrong.com Git - lilypond.git/blobdiff - stepmake/bin/install.py
Make distributed tarball from Git file list
[lilypond.git] / stepmake / bin / install.py
index 2a29e353c02453b027586fb4442fafabd66f8a2d..9818543a3f15022d74c0d1d0638e77b3af8cace8 100644 (file)
@@ -14,26 +14,26 @@ copy = False
 create_dir = False
 
 for (o,a) in opts:
-       if o == '-b':
-               transform_base = a
-       elif o == '-c':
-               copy = True
-       elif o == '-d':
-               create_dir = True
-       elif o == '-g':
-               group = a
-       elif o == '-m':
-               mode = string.atoi (a, 8)
-       elif o == '-o':
-               owner = a
-       elif o == '-s':
-               strip = True
-       elif o == '-t':
-               transform = a
-       elif o == '-h':
-               print ''' Usage: $0 [OPTION]... SRCFILE DSTFILE
  or: $0 [OPTION]... SRCFILES... DIRECTORY
  or: $0 -d DIRECTORIES...
+    if o == '-b':
+        transform_base = a
+    elif o == '-c':
+        copy = True
+    elif o == '-d':
+        create_dir = True
+    elif o == '-g':
+        group = a
+    elif o == '-m':
+        mode = string.atoi (a, 8)
+    elif o == '-o':
+        owner = a
+    elif o == '-s':
+        strip = True
+    elif o == '-t':
+        transform = a
+    elif o == '-h':
+        print ''' Usage: $0 [OPTION]... SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 -d DIRECTORIES...
 
 In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
 In the second, create the directory path DIR.
@@ -49,43 +49,47 @@ Options:
 -t=TRANSFORM
 --help     display this help and exit.
 --version  display version info and exit.'''
-               sys.exit (0)
+        sys.exit (0)
 
 if not mode:
-       if create_dir:
-               mode = 0755
-       else:
-               mode = 0644
-               
+    if create_dir:
+        mode = 0755
+    else:
+        mode = 0644
+        
 
 chown_me = []
 
 dest = None
 if not create_dir:
-       dest = args.pop()
+    dest = args.pop()
 
 for f in args:
-       if create_dir and not os.path.isdir (f):
-               os.makedirs (f, mode=mode)
-               chown_me.append (f)
-       else:
-               if copy:
-                       if os.path.exists (dest) and not os.path.isdir (dest):
-                               os.remove (dest)
-                       shutil.copy2 (f, dest)
-               else:
-                       shutil.move (f, dest)
-               if os.path.isdir (dest):
-                       chown_me.append (os.path.join (dest, os.path.basename (f)))
-               else:
-                       chown_me.append (dest)
+    if create_dir:
+        if os.path.isdir (f):
+            continue
+        
+        os.makedirs (f, mode=mode)
+        chown_me.append (f)
+    else:
+        if copy:
+            if os.path.exists (dest) and not os.path.isdir (dest):
+                os.remove (dest)
+            shutil.copy2 (f, dest)
+        else:
+            shutil.move (f, dest)
+
+        if os.path.isdir (dest):
+            chown_me.append (os.path.join (dest, os.path.basename (f)))
+        else:
+            chown_me.append (dest)
 
 for f in chown_me:
-       os.chmod (f, mode)
-       if group <> None or owner <> None:
-               os.chown (f, group, owner)
-       
-       
+    os.chmod (f, mode)
+    if group <> None or owner <> None:
+        os.chown (f, group, owner)
+    
+    
 
-               
+