setup.py revision 2516
20N/A# The contents of this file are subject to the terms of the 20N/A# Common Development and Distribution License (the "License"). 20N/A# You may not use this file except in compliance with the License. 20N/A# See the License for the specific language governing permissions 20N/A# and limitations under the License. 20N/A# When distributing Covered Code, include this CDDL HEADER in each 20N/A# If applicable, add the following below this CDDL HEADER, with the 20N/A# fields enclosed by brackets "[]" replaced with your own identifying 20N/A# information: Portions Copyright [yyyy] [name of copyright owner] 20N/A# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 0N/A# Unbuffer stdout and stderr. This helps to ensure that subprocess output 0N/A# is properly interleaved with output from this program. 0N/A# A list of source, destination tuples of modules which should be hardlinked 0N/A# together if the os supports it and otherwise copied. 'pkg.client.linkedimage',
'pkg.client.linkedimage',
# Runs lint on the extension module source code description =
"Runs pylint tools over IPS python source code" # Make string shell-friendly # Insert tests directory onto sys.path so any custom checkers # assumes pylint is accessible on the sys.path # For some reason, the load-plugins option, when used in the # rcfile, does not work, so we put it here instead, to load # Unfortunately, pylint seems pretty fragile and will crash if # we try to run it over all the current pkg source. Hence for # now we only run it over a subset of the source. As source # files are made pylint clean they should be added to the args = [
'--load-plugins=multiplatform']
lint_flags = [
'-u',
'-axms',
'-erroff=E_NAME_DEF_NOT_USED2' ]
# Runs lint on the extension module source code description =
"Runs lint tools over IPS C extension source code" # Make string shell-friendly # assumes lint is on the $PATH # Runs both C and Python lint # Make string shell-friendly # PRIVATE_BUILD set in the environment tells us to put the build # directory into the .pyc files, rather than the final # installation directory. # This is used when installing scripts, below, but it isn't a # standard distutils variable. At the end of the install function, we need to rename some files because distutils provides no way to rename files as they are placed in their install locations. Also, make sure that cherrypy and other external dependencies for e
in [
".py",
".pyc"]:
# make scripts executable print "checksumming %s" %
swname print >>
sys.
stderr,
"bad checksum! %s != %s" % \
print "downloading %s" %
swname print >>
sys.
stderr,
"Unable to retrieve %s.\n" \
"Please retrieve the file " \
# remove a partial download or error message from proxy # extractall doesn't exist until python 2.5 # If there are patches, apply them now. print "Applying %s to %s" % (p,
swname)
"patch failed and returned %d." %
ret "install failed and returned %d." %
ret print >>
sys.
stderr,
"ERROR: unable to obtain mercurial version" """ Run python's compiler over the file, and discard the results. Arrange to generate an exception if the file does not compile. This is needed because distutil's own use of pycompile (in the distutils.utils module) is broken, and doesn't stop on error. """ # Assume it's a tuple of (filename, lineno, col, code) res +=
"line %d, column %s, in %s:\n%s" % (
line,
# On Solaris, ld inserts the full argument to the -o option into the symbol # table. This means that the resulting object will be different depending on # the path at which the workspace lives, and not just on the interesting content # In order to work around that bug (7076871), we create a new compiler class # that looks at the argument indicating the output file, chdirs to its # directory, and runs the real link with the output file set to just the base # Unfortunately, distutils isn't too customizable in this regard, so we have to # twiddle with a couple of the names in the distutils.ccompiler namespace: we # have to add a new entry to the compiler_class dict, and we have to override # the new_compiler() function to point to our own. Luckily, our copy of # new_compiler() gets to be very simple, since we always know what we want to 'unixccompiler',
'MyUnixCCompiler',
'standard Unix-style compiler with a link stage modified for Solaris' # Gather the timestamps of the .py files in the gate, so we can # force the mtimes of the built and delivered copies to be # consistent across builds, causing their corresponding .pyc # files to be unchanged unless the .py file content changed. print >>
sys.
stderr,
"ERROR: unable to gather .py " \
# override the build_module method to do VERSION substitution on pkg/__init__.py # Grab the previously-built version out of the build vstr =
'VERSION = "%s"' % v
# If the versions haven't changed, there's no need to print "doing version substitution: ", v
# Will raise a DistutilsError on failure. # If the timestamp on the source file (coming from mercurial if # unchanged, or from the filesystem if changed) doesn't match # the filesystem timestamp on the destination, then force the # copy to make sure the right data is in place. # The timestamp for __init__.py is the timestamp for the # If we copied the file, then we need to go and readjust the # timestamp on the file to match what we have in our database. description =
"Deletes any and all files created by setup" # NOTE: these options need to be in sync with tests/run.py and the # list of options stored in initialize_options below. The first entry # in each tuple must be the exact name of a member variable. (
"archivedir=",
'a',
"archive failed tests <dir>"),
(
"baselinefile=",
'b',
"baseline file <file>"),
(
"coverage",
"c",
"collect code coverage data"),
(
"genbaseline",
'g',
"generate test baseline"),
(
"only=",
"o",
"only <regex>"),
(
"parseable",
'p',
"parseable output"),
(
"port=",
"z",
"lowest port to start a depot on"),
(
"timing",
"t",
"timing file <file>"),
(
"verbosemode",
'v',
"run tests in verbose mode"),
(
"enableguitests",
'u',
"enable IPS GUI tests, disabled by default"),
(
"stoponerr",
'x',
"stop when a baseline mismatch occurs"),
(
"debugoutput",
'd',
"emit debugging output"),
(
"showonexpectedfail",
'f',
"show all failure info, even for expected fails"),
(
"startattest=",
's',
"start at indicated test"),
(
"jobs=",
'j',
"number of parallel processes to use"),
(
"quiet",
"q",
"use the dots as the output format"),
# Reconstruct the cmdline and send that to run.py # These are set to real values based on the platform, down below if osname in (
"sunos",
"linux",
"darwin"):
# all builds of IPS should have manpages # Solaris-specific extensions are added here # Unix platforms which the elf extension has been ported to # are specified here, so they are built automatically # Solaris has built-in md library and Solaris-specific arch extension # All others use OpenSSL and cross-platform arch module