setup.py revision 3138
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] 2728N/A# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. 751N/A# the version of pylint that we must have in order to run the pylint checks. 1836N/A# Unbuffer stdout and stderr. This helps to ensure that subprocess output 2507N/A# is properly interleaved with output from this program. 466N/A# Extract Python minor version. 1968N/A# A list of source, destination tuples of modules which should be hardlinked 2028N/A# together if the os supports it and otherwise copied. 466N/A 'svc-pkg-repositories-setup'],
382N/A 'pkg.client.linkedimage',
858N/A 'pkg.client.linkedimage',
858N/A 'pkg.client.pkg_solver',
858N/A 'pkg.client.pkgremote',
858N/A 'pkg.client.printengine',
1431N/A # install same set of files in "en/" in "__LOCALE__/ as well" 1431N/A # for localizable file package (regarding themes, install 765N/A# The apache-based depot includes an shtml file we add to the resource dir 429N/A 'ar ca cs de es fr he hu id it ja ko nl pl pt_BR ru sk sv zh_CN zh_HK zh_TW'.
split()
1968N/A# Runs lint on the extension module source code 1968N/A # Make string shell-friendly 1968N/A """Compare the installed version against the version 812N/A we require to build with, returning False if the version 812N/A is too old. It's tempting to use pkg.version.Version 1968N/A here, but since that's a build artifact, we'll do it 812N/A # if the lists are of different lengths, we just 873N/A # compare with the precision we have. 812N/A # if we somehow get non-numeric version 1968N/A # components, we ignore them. 812N/A # it's fine to default to the required version - the build will 812N/A # break if the installed version is incompatible and $PYLINT_VER 1968N/A "$PKG_SKIP_PYLINT was set")
1968N/A "installed version %s is older than version %s" %
873N/A # Insert tests directory onto sys.path so any custom checkers 466N/A # assumes pylint is accessible on the sys.path 1633N/A # For some reason, the load-plugins option, when used in the 1633N/A # rcfile, does not work, so we put it here instead, to load 1968N/A # Unfortunately, pylint seems pretty fragile and will crash if 1968N/A # we try to run it over all the current pkg source. Hence for 1968N/A # now we only run it over a subset of the source. As source 1968N/A # files are made pylint clean they should be added to the 1020N/A# Runs lint on the extension module source code 2515N/A # Make string shell-friendly 2230N/A [
'-D_FILE_OFFSET_BITS=64'] + \
1968N/A [
'-D_FILE_OFFSET_BITS=64'] + \
1968N/A [
'-D_FILE_OFFSET_BITS=64'] + \
1968N/A [
'-D_FILE_OFFSET_BITS=64'] + \
429N/A [
'-D_FILE_OFFSET_BITS=64'] + \
1968N/A# Runs both C and Python lint 1968N/A # Make string shell-friendly 812N/A # PRIVATE_BUILD set in the environment tells us to put the build 812N/A # directory into the .pyc files, rather than the final 812N/A # installation directory. 812N/A # This is used when installing scripts, below, but it isn't a 812N/A # standard distutils variable. 1968N/A """At the end of the install function, we need to rename some 1968N/A files because distutils provides no way to rename files as they 1968N/A are placed in their install locations. 812N/A # Don't install the scripts for python 2.7. 812N/A """Remove the target files prior to the standard install_lib procedure 452N/A if the build_py module has determined that they've actually changed. 466N/A This may be needed when a module's timestamp goes backwards in time, if 858N/A a working-directory change is reverted, or an older changeset is checked 858N/A """Enhance the standard install_data subcommand to take not only a list 858N/A of filenames, but a list of source and destination filename tuples, for 858N/A the cases where a filename needs to be renamed between the two 466N/A # use temp environment modified with the given dict 1968N/A # just use environment of this (parent) process as is 612N/A # send stderr to devnull 1431N/A # just use stderr of this (parent) process 2028N/A """A clone of distutils.file_util._copy_file_contents() that strips the 2515N/A CDDL text. For Python files, we replace the CDDL text with an equal 2515N/A number of empty comment lines so that line numbers match between the 2515N/A source and destination files.""" 1895N/A # Match the lines between and including the CDDL header signposts, as 1431N/A # well as empty comment lines before and after, if they exist. 2065N/A # replace the CDDL expression 2028N/A # with the same number of empty 2028N/A # comment lines as the cddl_re 1431N/A# Make file_util use our version of _copy_file_contents 1542N/A """Check if scope of localization looks up-to-date or possibly not, 1542N/A actual source files (e.g. .py) detected. 1431N/A "New file(s) with translatable strings detected:" 452N/A"""Please evaluate whether any of the above file(s) needs localization. 452N/APlease be sure to maintain alphabetical ordering in both files.""" 451N/A """Generate pkg.pot by extracting localizable strings from source 2065N/A "Failed in generating pkg.pot." 873N/A """Checks for common i18n messaging bugs in the source.""" 873N/A # A list of the i18n errors we check for in the code # This checks that messages with multiple parameters are always # written using "%(name)s" format, rather than just "%s" "format string with unnamed arguments cannot be properly localized" "The following i18n errors were detected and should be corrected:\n" \
"""create XML help for localization, where French part of legalnotice # indicates currently in French part of legalnotice if in_fr:
# in French part # reached end of legalnotice """Input is English XML file. Output is pkg_help.pot, message source for next translation update. """Input is English XML file and <lang>.po file (which contains translations). Output is translated XML file. (
"file=",
"f",
"source file to copy"),
(
"dest=",
"d",
"destination directory"),
(
"mode=",
"m",
"file mode"),
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' # store our 64-bit extensions elsewhere # 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 # 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 # Force a copy of the file if the source timestamp is different # from that of the destination, not just if it's newer. This # allows timestamps in the working directory to regress (for # instance, following the reversion of a change). # 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. # Save the filename aside for our version of install_lib. description =
"build data files whose source isn't in deliverable form" # As a subclass of distutils.cmd.Command, these methods are required to # Anything that gets created here should get deleted in # clean_func.run() below. msgfmt(
"po/%s.po" % l,
"po/%s.mo" % l)
# generate pkg.pot for next translation """Remove a file without caring whether it exists.""" rm_f(
"po/.intltool-merge-cache")
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"),
(
"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"),
(
"livesystem",
'l',
"run tests on live system"),
# Reconstruct the cmdline and send that to run.py # This class wraps the distutils Extension class, allowing us to set # build_64 in the object constructor instead of being forced to add it # after the object has been created. # These are set to real values based on the platform, down below if osname in (
"sunos",
"linux",
"darwin"):
# We don't support 64-bit yet, but 64-bit _actions.so, _common.so, and # _varcet.so are needed for a system repository mod_wsgi application, # all builds of IPS should have manpages # Solaris-specific extensions are added here # install localizable .xml and its .pot file to put into localizable file package [(
'po/%s.mo' %
locale,
'pkg.mo')])
# install English .pot file to put into localizable file package # 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