File: diff

package info (click to toggle)
viewcvs 0.9.2%2Bcvs.1.0.dev.2004.07.28-4.1
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 1,452 kB
  • ctags: 1,355
  • sloc: python: 10,099; cpp: 840; ansic: 763; yacc: 526; sh: 163; makefile: 115
file content (123 lines) | stat: -rw-r--r-- 4,697 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
--- viewcvs-install	2003-06-26 05:29:03.000000000 +0900
+++ viewcvs-install-debian	2003-08-26 12:39:13.000000000 +0900
@@ -51,12 +51,9 @@
 """ % version
 
 ## installer defaults
-if sys.platform == "win32":
-  pf = os.getenv("ProgramFiles", "C:\\Program Files")
-  ROOT_DIR = os.path.join(pf, "viewcvs-" + version)  
-else:
-  ROOT_DIR = "/usr/local/viewcvs-" + version
-
+ROOT_DIR = "build-temp"
+LIB_DIR = "/usr/lib/python" + "%d.%d" % (sys.version_info[0], sys.version_info[1]) + "/viewcvs"
+SYSCONF_DIR = "/etc/viewcvs"
 
 ## list of files for installation
 ## tuple (source path, destination path, install mode, true/false flag for
@@ -65,17 +62,15 @@
 ##       
 
 FILE_INFO_LIST = [
-    ("www/cgi/viewcvs.cgi", "www/cgi/viewcvs.cgi", 0755, 1, 0, 0),
-    ("www/cgi/query.cgi", "www/cgi/query.cgi", 0755, 1, 0, 0),
-    ("www/mod_python/viewcvs.py", "www/mod_python/viewcvs.py", 0755, 1, 0, 0),
-    ("www/mod_python/query.py", "www/mod_python/query.py", 0755, 1, 0, 0),
-    ("www/mod_python/.htaccess", "www/mod_python/.htaccess", 0755, 1, 0, 0),
+    ("cgi/viewcvs.cgi", "cgi/viewcvs.cgi", 0755, 1, 0, 0),
+    ("cgi/query.cgi", "cgi/query.cgi", 0755, 1, 0, 0),
     ("standalone.py", "standalone.py", 0755, 1, 0, 0),
-    ("viewcvs.conf.dist", "viewcvs.conf", 0644, 1,
+
+    ("cgi/viewcvs.conf.dist", "viewcvs.conf", 0644, 1,
 	     """Note: If you are upgrading from viewcvs-0.7 or earlier: 
 The section [text] has been removed from viewcvs.conf.  The functionality
 went into the new files in subdirectory templates.""", 0),
-    ("cvsgraph.conf.dist", "cvsgraph.conf", 0644, 0, 1, 0),
+    ("cgi/cvsgraph.conf.dist", "cvsgraph.conf", 0644, 0, 1, 0),
 
     ("tools/loginfo-handler", "loginfo-handler", 0755, 1, 0, 0),
     ("tools/cvsdbadmin", "cvsdbadmin", 0755, 1, 0, 0),
@@ -84,8 +79,11 @@
 
 if sys.platform == "win32":
   FILE_INFO_LIST.extend([
-    ("www/asp/viewcvs.asp", "www/asp/viewcvs.asp", 0755, 1, 0, 0),
-    ("www/asp/query.asp", "www/asp/query.asp", 0755, 1, 0, 0),
+    ("windows/viewcvs.asp", "windows/viewcvs.asp", 0755, 1, 0, 0),
+    ("windows/query.asp", "windows/query.asp", 0755, 1, 0, 0),
+    ("windows/viewcvs.py", "windows/viewcvs.py", 0755, 1, 0, 0),
+    ("windows/query.py", "windows/query.py", 0755, 1, 0, 0),
+    ("windows/htaccess.mod_python", "windows/htaccess.mod_python", 0755, 1, 0, 0)
   ])
 
 TREE_LIST = [
@@ -130,21 +128,26 @@
 
 
 
-def SetOnePath(contents, var, value):
+def SetLibPath(contents, var, value):
     pattern = re.compile('^' + var + r'\s*=\s*.*$', re.MULTILINE)
-    repl = '%s = r"%s"' % (var, os.path.join(ROOT_DIR, value))
+    repl = '%s = "%s"' % (var, os.path.join(LIB_DIR, value))
     return re.sub(pattern, ReEscape(repl), contents)
 
+def SetConfPath(contents, var, value):
+    pattern = re.compile('^' + var + r'\s*=\s*.*$', re.MULTILINE)
+    repl = '%s = "%s"' % (var, os.path.join(SYSCONF_DIR, value))
+    return re.sub(pattern, repl, contents) 
 
 def SetPythonPaths(contents):
     if contents[:2] == '#!':
         shbang = '#!' + sys.executable
         contents = re.sub('^#![^\n]*', ReEscape(shbang), contents)
-    contents = re.sub("<VIEWCVS_INSTALL_DIRECTORY>", ReEscape(ROOT_DIR), contents)
     apacheDir = ApacheEscape(os.path.join(ROOT_DIR, 'lib'))
     contents = re.sub("<VIEWCVS_APACHE_LIBRARY_DIRECTORY>", ReEscape(apacheDir), contents)
-    contents = SetOnePath(contents, 'LIBRARY_DIR', 'lib')
-    contents = SetOnePath(contents, 'CONF_PATHNAME', 'viewcvs.conf')
+    contents = re.sub("<VIEWCVS_INSTALL_DIRECTORY>", ReEscape(LIB_DIR), contents)
+    contents = re.sub("<SYSCONF_DIR>", ReEscape(SYSCONF_DIR), contents)
+    contents = SetLibPath(contents, 'LIBRARY_DIR', '')
+    contents = SetConfPath(contents, 'CONF_PATHNAME', 'viewcvs.conf')
     return contents
 
 
@@ -227,7 +230,8 @@
   os.chmod(dest_path, mode)
   
   if compile_it:
-    py_compile.compile(dest_path)
+    dfile = os.path.join(LIB_DIR, basename)
+    py_compile.compile(dest_path, None, dfile)
   
   return
 
@@ -277,13 +281,13 @@
 
 ## MAIN
 if __name__ == "__main__":
-    print INFO_TEXT
+#    print INFO_TEXT
     
     ## get the install path
-    temp = raw_input("Installation Path [%s]: " % ROOT_DIR)
-    temp = string.strip(temp)
-    if len(temp):
-        ROOT_DIR = temp
+#    temp = raw_input("Installation Path [%s]: " % ROOT_DIR)
+#    temp = string.strip(temp)
+#    if len(temp):
+#        ROOT_DIR = temp
         
     ## install the files
     print
@@ -314,5 +318,5 @@
    %s.
 """ % (
     os.path.join(ROOT_DIR, 'viewcvs.conf'),
-    os.path.join(ROOT_DIR, 'www', 'cgi', 'viewcvs.cgi'),
+    os.path.join(ROOT_DIR, 'cgi', 'viewcvs.cgi'),
     os.path.join(ROOT_DIR, 'standalone.py'))