Author: cmpilato
Date: 2006-12-20 10:14:51-0800
New Revision: 1489
Modified:
branches/1.0.x/CHANGES
branches/1.0.x/viewvc-install
Log:
Backport to viewvc-1.0.x the latest and greatest viewvc-install, which
brings the ability to be run from an arbitrary location, and vastly
improves the output.
* viewvc-install
Bring into sync with trunk as of r1488.
* CHANGES
Note these changes.
Modified: branches/1.0.x/CHANGES
Url:
http://viewvc.tigris.org/source/browse/viewvc/branches/1.0.x/CHANGES?view=diff&rev=1489&p1=branches/1.0.x/CHANGES&p2=branches/1.0.x/CHANGES&r1=1488&r2=1489
==============================================================================
--- branches/1.0.x/CHANGES (original)
+++ branches/1.0.x/CHANGES 2006-12-20 10:14:51-0800
@@ -2,6 +2,8 @@
* fix some markup bugs in query views (issue #266)
* fix loginfo-handler's support for CVS 1.12.9 (issues #151, #257)
+ * make viewvc-install able to run from an arbitrary location
+ * update viewvc-install's output for readability
Version 1.0.3 (released 13-Oct-2006)
Modified: branches/1.0.x/viewvc-install
Url:
http://viewvc.tigris.org/source/browse/viewvc/branches/1.0.x/viewvc-install?view=diff&rev=1489&p1=branches/1.0.x/viewvc-install&p2=branches/1.0.x/viewvc-install&r1=1488&r2=1489
==============================================================================
--- branches/1.0.x/viewvc-install (original)
+++ branches/1.0.x/viewvc-install 2006-12-20 10:14:51-0800
@@ -11,10 +11,7 @@
#
# -----------------------------------------------------------------------
#
-# install script for viewvc -- temporary?
-#
-# ### this will eventually be replaced by autoconf plus tools. an
-# ### interactive front-end to ./configure may be provided.
+# Install script for ViewVC
#
# -----------------------------------------------------------------------
@@ -27,7 +24,7 @@
import getopt
import StringIO
-# get access to our library modules
+# Get access to our library modules.
sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), 'lib'))
import compat
@@ -36,324 +33,440 @@
version = viewvc.__version__
-## installer text
-INFO_TEXT = """
-
-This is the ViewVC %s installer.
-
-It will allow you to choose the install path for ViewVC. You will
-now be asked some installation questions.
-
-Defaults are given in square brackets. Just hit [Enter] if a default
-is okay.
-""" % version
-
-## installer defaults
+## Installer defaults.
DESTDIR = None
ROOT_DIR = None
+CLEAN_MODE = None
-## list of files for installation
-## tuple (source path, destination path, install mode, true/false flag for
-## search-and-replace, flag or text for prompt before replace,
-## compile_it)
-##
-
+## List of files for installation.
+## tuple (source path,
+## destination path,
+## mode,
+## boolean -- search-and-replace?
+## boolean -- prompt before replacing?
+## boolean -- compile?)
FILE_INFO_LIST = [
- ("bin/cgi/viewvc.cgi", "bin/cgi/viewvc.cgi", 0755, 1, 0, 0),
- ("bin/cgi/query.cgi", "bin/cgi/query.cgi", 0755, 1, 0, 0),
- ("bin/mod_python/viewvc.py", "bin/mod_python/viewvc.py", 0755, 1, 0, 0),
- ("bin/mod_python/query.py", "bin/mod_python/query.py", 0755, 1, 0, 0),
+ ("bin/cgi/viewvc.cgi", "bin/cgi/viewvc.cgi", 0755, 1, 0, 0),
+ ("bin/cgi/query.cgi", "bin/cgi/query.cgi", 0755, 1, 0, 0),
+ ("bin/mod_python/viewvc.py", "bin/mod_python/viewvc.py", 0755, 1, 0, 0),
+ ("bin/mod_python/query.py", "bin/mod_python/query.py", 0755, 1, 0, 0),
("bin/mod_python/handler.py", "bin/mod_python/handler.py", 0755, 1, 0, 0),
- ("bin/mod_python/.htaccess", "bin/mod_python/.htaccess", 0755, 0, 0, 0),
- ("bin/standalone.py", "bin/standalone.py", 0755, 1, 0, 0),
- ("viewvc.conf.dist", "viewvc.conf", 0644, 0,
- """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),
-
- ("bin/loginfo-handler", "bin/loginfo-handler", 0755, 1, 0, 0),
- ("bin/cvsdbadmin", "bin/cvsdbadmin", 0755, 1, 0, 0),
- ("bin/svndbadmin", "bin/svndbadmin", 0755, 1, 0, 0),
- ("bin/make-database", "bin/make-database", 0755, 1, 0, 0),
+ ("bin/mod_python/.htaccess", "bin/mod_python/.htaccess", 0755, 0, 0, 0),
+ ("bin/standalone.py", "bin/standalone.py", 0755, 1, 0, 0),
+ ("bin/loginfo-handler", "bin/loginfo-handler", 0755, 1, 0, 0),
+ ("bin/cvsdbadmin", "bin/cvsdbadmin", 0755, 1, 0, 0),
+ ("bin/svndbadmin", "bin/svndbadmin", 0755, 1, 0, 0),
+ ("bin/make-database", "bin/make-database", 0755, 1, 0, 0),
+ ("viewvc.conf.dist", "viewvc.conf.dist", 0644, 0, 0, 0),
+ ("viewvc.conf.dist", "viewvc.conf", 0644, 0, 1, 0),
+ ("cvsgraph.conf.dist", "cvsgraph.conf.dist", 0644, 0, 0, 0),
+ ("cvsgraph.conf.dist", "cvsgraph.conf", 0644, 0, 1, 0),
]
-
if sys.platform == "win32":
FILE_INFO_LIST.extend([
- ("bin/asp/viewvc.asp", "bin/asp/viewvc.asp", 0755, 1, 0, 0),
- ("bin/asp/query.asp", "bin/asp/query.asp", 0755, 1, 0, 0),
+ ("bin/asp/viewvc.asp", "bin/asp/viewvc.asp", 0755, 1, 0, 0),
+ ("bin/asp/query.asp", "bin/asp/query.asp", 0755, 1, 0, 0),
])
+
+## List of directories for installation.
+## type (source path,
+## destination path,
+## boolean -- prompt before replacing?)
TREE_LIST = [
- ("lib", "lib", 0),
- ("templates", "templates", 1),
- ]
-
-# used to escape substitution strings passed to re.sub(). re.escape() is no
-# good because it blindly puts backslashes in front of anything that is not
-# a number or letter regardless of whether the resulting sequence will be
-# interpreted.
-def ReEscape(str):
- return string.replace(str, "\\", "\\\\")
-
-def Error(text, etype=None, evalue=None):
- print
- print "[ERROR] %s" % text
- if etype:
- print '[ERROR] ',
- traceback.print_exception(etype, evalue, None, file=sys.stdout)
- sys.exit(1)
-
+ ("lib", "lib", 0),
+ ("templates", "templates", 1),
+ ]
-def MkDir(path):
- try:
- compat.makedirs(path)
- except os.error, e:
- if e[0] == 17:
- # EEXIST: file exists
- return
- if e[0] == 13:
- # EACCES: permission denied
- Error("You do not have permission to create directory %s" % path)
- Error("Unknown error creating directory %s" % path, OSError, e)
+
+## List of file extensions we can't show diffs for.
+BINARY_FILE_EXTS = [
+ '.png',
+ '.gif',
+ '.jpg',
+ ]
+def _escape(str):
+ """Callback function for re.sub().
-def SetOnePath(contents, var, value):
+ re.escape() is no good because it blindly puts backslashes in
+ front of anything that is not a number or letter regardless of
+ whether the resulting sequence will be interpreted."""
+ return string.replace(str, "\\", "\\\\")
+
+
+def _actual_src_path(path):
+ """Return the real on-disk location of PATH, which is relative to
+ the ViewVC source directory."""
+ return os.path.join(os.path.dirname(sys.argv[0]),
+ string.replace(path, '/', os.sep))
+
+
+def error(text, etype=None, evalue=None):
+ """Print error TEXT to stderr, pretty printing the optional
+ exception type and value (ETYPE and EVALUE, respective), and then
+ exit the program with an errorful code."""
+ sys.stderr.write("\n[ERROR] %s\n" % (text))
+ if etype:
+ traceback.print_exception(etype, evalue, None, file=sys.stderr)
+ sys.exit(1)
+
+
+def replace_var(contents, var, value):
+ """Replace instances of the variable VAR as found in file CONTENTS
+ with VALUE."""
pattern = re.compile('^' + var + r'\s*=\s*.*$', re.MULTILINE)
repl = '%s = r"%s"' % (var, os.path.join(ROOT_DIR, value))
- return re.sub(pattern, ReEscape(repl), contents)
+ return re.sub(pattern, _escape(repl), contents)
-def SetPythonPaths(contents):
+def replace_paths(contents):
+ """Replace all ViewVC path placeholders found in file CONTENTS."""
if contents[:2] == '#!':
shbang = '#!' + sys.executable
- contents = re.sub('^#![^\n]*', ReEscape(shbang), contents)
- contents = SetOnePath(contents, 'LIBRARY_DIR', 'lib')
- contents = SetOnePath(contents, 'CONF_PATHNAME', 'viewvc.conf')
+ contents = re.sub('^#![^\n]*', _escape(shbang), contents)
+ contents = replace_var(contents, 'LIBRARY_DIR', 'lib')
+ contents = replace_var(contents, 'CONF_PATHNAME', 'viewvc.conf')
return contents
-def InstallFile(src_path, dest_path, mode, set_python_paths, prompt_replace,
- compile_it):
- dest_path = os.path.join(ROOT_DIR, dest_path)
+def install_file(src_path, dst_path, mode, subst_path_vars,
+ prompt_replace, compile_it):
+ """Install a single file whose source is at SRC_PATH (which is
+ relative to the ViewVC source directory) into the location
+ DST_PATH (which is relative both to the global ROOT_DIR and
+ DESTDIR settings), and set the file's MODE. If SUBST_PATH_VARS is
+ set, substitute path variables in the file's contents. If
+ PROMPT_REPLACE is set (and is not overridden by global setting
+ CLEAN_MODE), prompt the user for how to deal with already existing
+ files that differ from the to-be-installed version. If COMPILE_IT
+ is set, compile the file as a Python module."""
- if prompt_replace and os.path.exists(DESTDIR + dest_path):
- # Collect ndiff output from ndiff
- sys.stdout = StringIO.StringIO()
- compat_ndiff.main([DESTDIR + dest_path, src_path])
- ndiff_output = sys.stdout.getvalue()
-
- # Return everything to normal
- sys.stdout = sys.__stdout__
-
- # Collect the '+ ' and '- ' lines
- # total collects the difference lines to be printed later
- total = ""
- # I use flag to throw out match lines.
- flag = 1
- for line in string.split(ndiff_output,'\n'):
- # Print line if it is a difference line
- if line[:2] == "+ " or line[:2] == "- " or line[:2] == "? ":
- total = total + line + "\n"
- flag = 1
- else:
- # Compress lines that are the same to print one blank line
- if flag:
- total = total + "\n"
- flag = 0
-
- if total == "\n":
- print " File %s exists,\n but there is no difference between
target and source files.\n" % (DESTDIR + dest_path)
- return
-
- if type(prompt_replace) == type(""):
- print prompt_replace
- while 1:
- temp = raw_input("""
- File %s exists and is different from source file.
- DO YOU WANT TO,
- overwrite [o]
- do not overwrite [d]
- view differences [v]: """ % (DESTDIR + dest_path))
- print
-
- temp = string.lower(temp[0])
-
- if temp == "d":
- return
-
- if temp == "v":
- if string.lower(src_path[-4:]) in [ '.gif', '.png', '.jpg' ]:
- print 'Can not print differences between binary files'
+ src_path = _actual_src_path(src_path)
+ dst_path = os.path.join(ROOT_DIR, string.replace(dst_path, '/', os.sep))
+ destdir_path = DESTDIR + dst_path
+
+ overwrite = None
+ if not (prompt_replace and os.path.exists(destdir_path)):
+ # If the file doesn't already exist, or we've been instructed to
+ # replace it without prompting, then drop in the new file and get
+ # outta here.
+ overwrite = 1
+ else:
+ # If we're here, then the file already exists, and we've possibly
+ # got to prompt the user for what to do about that.
+
+ # Collect ndiff output from ndiff
+ sys.stdout = StringIO.StringIO()
+ compat_ndiff.main([destdir_path, src_path])
+ ndiff_output = sys.stdout.getvalue()
+
+ # Return everything to normal
+ sys.stdout = sys.__stdout__
+
+ # Collect the '+ ' and '- ' lines.
+ diff_lines = []
+ looking_at_diff_lines = 0
+ for line in string.split(ndiff_output, '\n'):
+ # Print line if it is a difference line
+ if line[:2] == "+ " or line[:2] == "- " or line[:2] == "? ":
+ diff_lines.append(line)
+ looking_at_diff_lines = 1
+ else:
+ # Compress lines that are the same to print one blank line
+ if looking_at_diff_lines:
+ diff_lines.append("")
+ looking_at_diff_lines = 0
+
+ # If there are no differences, we're done here.
+ if not diff_lines:
+ overwrite = 1
else:
- print total
- print """
+ # If we get here, there are differences.
+ if CLEAN_MODE == 'true':
+ overwrite = 1
+ elif CLEAN_MODE == 'false':
+ overwrite = 0
+ else:
+ print "File %s exists and is different from source file." \
+ % (destdir_path)
+ while 1:
+ name, ext = os.path.splitext(src_path)
+ if ext in BINARY_FILE_EXTS:
+ temp = raw_input("Do you want to [O]verwrite or "
+ "[D]o not overwrite? ")
+ else:
+ temp = raw_input("Do you want to [O]verwrite, [D]o "
+ "not overwrite, or [V]iew "
+ "differences? ")
+ temp = string.lower(temp[0])
+ if temp == "v" and ext not in BINARY_FILE_EXTS:
+ print """
+---------------------------------------------------------------------------"""
+ print string.join(diff_lines, '\n') + '\n'
+ print """
LEGEND
- A leading '- ' indicates line to remove from installed file
- A leading '+ ' indicates line to add to installed file
- A leading '? ' shows intraline differences."""
-
- if temp == "o":
- ReplaceFile(src_path, dest_path, mode, set_python_paths,
- prompt_replace, compile_it)
+ A leading '- ' indicates line to remove from installed file
+ A leading '+ ' indicates line to add to installed file
+ A leading '? ' shows intraline differences.
+---------------------------------------------------------------------------"""
+ elif temp == "d":
+ overwrite = 0
+ elif temp == "o":
+ overwrite = 1
+
+ if overwrite is not None:
+ break
+
+ assert overwrite is not None
+ if not overwrite:
+ print " preserved %s" % (dst_path)
return
- else:
- ReplaceFile(src_path, dest_path, mode, set_python_paths,
- prompt_replace, compile_it)
- return
-
-def ReplaceFile(src_path, dest_path, mode, set_python_paths,
- prompt_replace, compile_it):
- try:
- contents = open(src_path, "rb").read()
- except IOError, e:
- Error(str(e))
-
- if set_python_paths:
- contents = SetPythonPaths(contents)
-
- ## write the file to the destination location
- path, basename = os.path.split(DESTDIR + dest_path)
- MkDir(path)
-
- try:
- open(DESTDIR + dest_path, "wb").write(contents)
- except IOError, e:
- if e[0] == 13:
- # EACCES: permission denied
- Error("You do not have permission to write file %s" % dest_path)
- Error("Unknown error writing file %s" % dest_path, IOError, e)
-
- os.chmod(DESTDIR + dest_path, mode)
-
- if compile_it:
- py_compile.compile(DESTDIR + dest_path,
- DESTDIR + dest_path + "c" , dest_path)
-
- return
+
+ ### If we get here, we're creating or overwriting the existing file.
+
+ # Read the source file's contents.
+ try:
+ contents = open(src_path, "rb").read()
+ except IOError, e:
+ error(str(e))
+
+ # (Optionally) substitute ViewVC path variables.
+ if subst_path_vars:
+ contents = replace_paths(contents)
+
+ # Ensure the existence of the containing directories.
+ dst_parent = os.path.dirname(destdir_path)
+ if not os.path.exists(dst_parent):
+ try:
+ compat.makedirs(dst_parent)
+ print " created %s/" % (dst_parent)
+ except os.error, e:
+ if e[0] == 17: # EEXIST: file exists
+ return
+ if e[0] == 13: # EACCES: permission denied
+ error("You do not have permission to create directory %s" \
+ % (dst_parent))
+ error("Unknown error creating directory %s" \
+ % (dst_parent, OSError, e))
+
+ # Now, write the file contents to their destination.
+ try:
+ exists = os.path.exists(destdir_path)
+ open(destdir_path, "wb").write(contents)
+ print " %s %s" \
+ % (exists and 'replaced ' or 'installed', dst_path)
+ except IOError, e:
+ if e[0] == 13:
+ # EACCES: permission denied
+ error("You do not have permission to write file %s" % (dst_path))
+ error("Unknown error writing file %s" % (dst_path, IOError, e))
+
+ # Set the files's mode.
+ os.chmod(destdir_path, mode)
+
+ # (Optionally) compile the file.
+ if compile_it:
+ py_compile.compile(destdir_path, destdir_path + "c" , dst_path)
def install_tree(src_path, dst_path, prompt_replace):
- files = os.listdir(src_path)
- files.sort()
- for fname in files:
- # eliminate some items which appear in a development area
- if fname == 'CVS' or fname == '.svn' or fname == '_svn' \
- or fname[-4:] == '.pyc' or fname[-5:] == '.orig' \
- or fname[-4:] == '.rej' or fname[0] == '.' \
- or fname[-1] == '~':
- continue
-
- src = os.path.join(src_path, fname)
- dst = os.path.join(dst_path, fname)
- if os.path.isdir(src):
- install_tree(src, dst, prompt_replace)
- else:
- print " ", src
- set_paths = 0
- compile_it = fname[-3:] == '.py'
- InstallFile(src, dst, 0644, set_paths, prompt_replace, compile_it)
-
- # prompt to delete all .py and .pyc files that don't belong in installation
- full_dst_path = os.path.join(DESTDIR + ROOT_DIR, dst_path)
- for fname in os.listdir(full_dst_path):
- if not os.path.isfile(os.path.join(full_dst_path, fname)) or \
- not ((fname[-3:] == '.py' and fname not in files) or
- (fname[-4:] == '.pyc' and fname[:-1] not in files)):
- continue
-
- while 1:
- temp = raw_input("""
- File %s does not belong in ViewVC %s.
- DO YOU WANT TO,
- delete [d]
- leave as is [l]: """ % (os.path.join(dst_path, fname), version))
- print
-
- temp = string.lower(temp[0])
-
- if temp == "l":
- break
+ """Install a tree whose source is at SRC_PATH (which is relative
+ to the ViewVC source directory) into the location DST_PATH (which
+ is relative both to the global ROOT_DIR and DESTDIR settings). If
+ PROMPT_REPLACE is set (and is not overridden by global setting
+ CLEAN_MODE), prompt the user for how to deal with already existing
+ files that differ from the to-be-installed version."""
+
+ orig_src_path = src_path
+ orig_dst_path = dst_path
+ src_path = _actual_src_path(src_path)
+ dst_path = os.path.join(ROOT_DIR, string.replace(dst_path, '/', os.sep))
+ destdir_path = os.path.join(DESTDIR + dst_path)
+
+ # Get a list of items in the directory.
+ files = os.listdir(src_path)
+ files.sort()
+ for fname in files:
+ # Ignore some stuff found in development directories, but not
+ # intended for installation.
+ if fname == 'CVS' or fname == '.svn' or fname == '_svn' \
+ or fname[-4:] == '.pyc' or fname[-5:] == '.orig' \
+ or fname[-4:] == '.rej' or fname[0] == '.' \
+ or fname[-1] == '~':
+ continue
+
+ orig_src_child = orig_src_path + '/' + fname
+ orig_dst_child = orig_dst_path + '/' + fname
+
+ # If the item is a subdirectory, recurse. Otherwise, install the file.
+ if os.path.isdir(os.path.join(src_path, fname)):
+ install_tree(orig_src_child, orig_dst_child, prompt_replace)
+ else:
+ set_paths = 0
+ compile_it = fname[-3:] == '.py'
+ install_file(orig_src_child, orig_dst_child, 0644,
+ set_paths, prompt_replace, compile_it)
+
+ # Check for .py and .pyc files that don't belong in installation.
+ for fname in os.listdir(destdir_path):
+ if not os.path.isfile(os.path.join(destdir_path, fname)) or \
+ not ((fname[-3:] == '.py' and fname not in files) or
+ (fname[-4:] == '.pyc' and fname[:-1] not in files)):
+ continue
+
+ # If we get here, there's cruft.
+ delete = None
+ if CLEAN_MODE == 'true':
+ delete = 1
+ elif CLEAN_MODE == 'false':
+ delete = 0
+ else:
+ print "File %s does not belong in ViewVC %s." \
+ % (dst_path, version)
+ while 1:
+ temp = raw_input("Do you want to [D]elete it, or [L]eave "
+ "it as is? ")
+ temp = string.lower(temp[0])
+ if temp == "l":
+ delete = 0
+ elif temp == "d":
+ delete = 1
+
+ if delete is not None:
+ break
+
+ assert delete is not None
+ if delete:
+ print " deleted %s" % (os.path.join(dst_path, fname))
+ os.unlink(os.path.join(destdir_path, fname))
+ else:
+ print " preserved %s" % (os.path.join(dst_path, fname))
- if temp == "d":
- os.unlink(os.path.join(full_dst_path, fname))
- break
-## MAIN
+
+def usage_and_exit(errstr=None):
+ stream = errstr and sys.stderr or sys.stdout
+ stream.write("""Usage: %s [OPTIONS]
+
+Installs the ViewVC web-based version control repository browser.
+
+Options:
+
+ --help, -h, -? Show this usage message and exit.
+
+ --prefix=DIR Install ViewVC into the directory DIR. If not provided,
+ the script will prompt for this information.
+
+ --destdir=DIR Use DIR as the DESTDIR. This is generally only used
+ by package maintainers. If not provided, the script will
+ prompt for this information.
+
+ --clean-mode= If 'true', overwrite existing ViewVC configuration files
+ found in the target directory, and purge Python modules
+ from the target directory that aren't part of the ViewVC
+ distribution. If 'false', do not overwrite configuration
+ files, and do not purge any files from the target
+ directory. If not specified, the script will prompt
+ for the appropriate action on a per-file basis.
+
+""" % (os.path.basename(sys.argv[0])))
+ if errstr:
+ stream.write("ERROR: %s\n\n" % (errstr))
+ sys.exit(1)
+ else:
+ sys.exit(0)
+
+
if __name__ == "__main__":
- # option parsing
+ # Option parsing.
try:
- optlist, args = getopt.getopt(sys.argv[1:], "", ['prefix=', 'destdir='])
+ optlist, args = getopt.getopt(sys.argv[1:], "h?",
+ ['prefix=',
+ 'destdir=',
+ 'clean-mode=',
+ 'help'])
except getopt.GetoptError, e:
- Error("Invalid option", getopt.GetoptError, e)
+ usage_and_exit(str(e))
for opt, arg in optlist:
- if opt == '--prefix':
- ROOT_DIR = arg
- if opt == '--destdir':
- DESTDIR = arg
-
- ## print greeting
- print INFO_TEXT
+ if opt == '--help' or opt == '-h' or opt == '-?':
+ usage_and_exit()
+ if opt == '--prefix':
+ ROOT_DIR = arg
+ if opt == '--destdir':
+ DESTDIR = arg
+ if opt == '--clean-mode':
+ arg = arg.lower()
+ if arg not in ('true', 'false'):
+ usage_and_exit("Invalid value for --overwrite parameter.")
+ CLEAN_MODE = arg
+
+ # Print the header greeting.
+ print """This is the ViewVC %s installer.
+
+It will allow you to choose the install path for ViewVC. You will now
+be asked some installation questions. Defaults are given in square brackets.
+Just hit [Enter] if a default is okay.
+""" % version
- ## prompt for ROOT_DIR if none provided
+ # Prompt for ROOT_DIR if none provided.
if ROOT_DIR is None:
- if sys.platform == "win32":
- pf = os.getenv("ProgramFiles", "C:\\Program Files")
- default = os.path.join(pf, "viewvc-" + version)
- else:
- default = "/usr/local/viewvc-" + version
- temp = string.strip(raw_input("Installation path [%s]: " % default))
- print
- if len(temp):
- ROOT_DIR = temp
- else:
- ROOT_DIR = default
-
- ## prompt for DESTDIR if none provided
+ if sys.platform == "win32":
+ pf = os.getenv("ProgramFiles", "C:\\Program Files")
+ default = os.path.join(pf, "viewvc-" + version)
+ else:
+ default = "/usr/local/viewvc-" + version
+ temp = string.strip(raw_input("Installation path [%s]: " \
+ % default))
+ print
+ if len(temp):
+ ROOT_DIR = temp
+ else:
+ ROOT_DIR = default
+
+ # Prompt for DESTDIR if none provided.
if DESTDIR is None:
- default = ''
- temp = string.strip(raw_input(
- "DESTDIR path (generally, only package maintainers will need "
- "to change\nthis) [%s]: " % default))
- print
- if len(temp):
- DESTDIR = temp
- else:
- DESTDIR = default
-
- ## install the files
- print "Installing ViewVC to:", ROOT_DIR,
- if DESTDIR:
- print "(DESTDIR = %s)" % (DESTDIR)
- else:
- print
-
+ default = ''
+ temp = string.strip(raw_input(
+ "DESTDIR path (generally only used by package "
+ "maintainers) [%s]: " \
+ % default))
+ print
+ if len(temp):
+ DESTDIR = temp
+ else:
+ DESTDIR = default
+
+ # Install the files.
+ print "Installing ViewVC to %s%s:" \
+ % (ROOT_DIR, DESTDIR and " (DESTDIR = %s)" % (DESTDIR) or "")
for args in FILE_INFO_LIST:
- print " ", args[0]
- apply(InstallFile, args)
-
+ apply(install_file, args)
for args in TREE_LIST:
- apply(install_tree, args)
-
+ apply(install_tree, args)
+
+ # Print some final thoughts.
print """
-ViewVC File Installation Complete
-
-Consult INSTALL for detailed information to finish the installation
-and configure ViewVC for your system.
-
-Overview of remaining steps:
-
-1) Edit the %s file.
+ViewVC file installation complete.
-2) Configure an existing web server to run (or copy to cgi-bin)
- %s.
- OR
- Run the web server that comes with ViewVC at
- %s.
-""" % (
- os.path.join(ROOT_DIR, 'viewvc.conf'),
- os.path.join(ROOT_DIR, 'bin', 'cgi', 'viewvc.cgi'),
- os.path.join(ROOT_DIR, 'standalone.py'))
+Consult the INSTALL document for detailed information on completing the
+installation and configuration of ViewVC on your system. Here's a brief
+overview of the remaining steps:
+
+ 1) Edit the %s file.
+
+ 2) Either configure an existing web server to run
+ %s.
+
+ Or, copy %s to an
+ already-configured cgi-bin directory.
+
+ Or, use the standalone server provided by this distribution at
+ %s.
+""" % (os.path.join(ROOT_DIR, 'viewvc.conf'),
+ os.path.join(ROOT_DIR, 'bin', 'cgi', 'viewvc.cgi'),
+ os.path.join(ROOT_DIR, 'bin', 'cgi', 'viewvc.cgi'),
+ os.path.join(ROOT_DIR, 'bin', 'standalone.py'))
|