setup.py revision 2561
290N/A# The contents of this file are subject to the terms of the 290N/A# Common Development and Distribution License (the "License"). 290N/A# You may not use this file except in compliance with the License. 290N/A# See the License for the specific language governing permissions 290N/A# and limitations under the License. 290N/A# When distributing Covered Code, include this CDDL HEADER in each 290N/A# If applicable, add the following below this CDDL HEADER, with the 290N/A# fields enclosed by brackets "[]" replaced with your own identifying 290N/A# information: Portions Copyright [yyyy] [name of copyright owner] 2223N/A# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 465N/A# Unbuffer stdout and stderr. This helps to ensure that subprocess output 465N/A# is properly interleaved with output from this program. 1191N/A# A list of source, destination tuples of modules which should be hardlinked 2180N/A# together if the os supports it and otherwise copied. 742N/A 'pkg.client.linkedimage',
290N/A 'C ar ca cs de es fr hu id it ja ko pl pt_BR ru sv zh_CN zh_HK zh_TW'.
split()
395N/A for n
in 'pkgmgr-main startpage_new update_all_new webinstall'.
split()
395N/A 'C ar ca cs de es fr hu id it ja ko nl pt_BR ru sv zh_CN zh_HK zh_TW'.
split()
591N/A 'dialog-information',
'dialog-warning',
'hc_dialog-information',
591N/A 'hc_dialog-warning',
'hc_install',
'hc_opensolaris',
691N/A 'hci_dialog-information',
'hci_dialog-warning',
'hci_install',
691N/A 'hci_opensolaris',
'install',
'opensolaris' 591N/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()
290N/A# Runs lint on the extension module source code 506N/A # Make string shell-friendly 506N/A # Insert tests directory onto sys.path so any custom checkers 395N/A # assumes pylint is accessible on the sys.path 883N/A # For some reason, the load-plugins option, when used in the 883N/A # rcfile, does not work, so we put it here instead, to load 413N/A # Unfortunately, pylint seems pretty fragile and will crash if 413N/A # we try to run it over all the current pkg source. Hence for 395N/A # now we only run it over a subset of the source. As source 290N/A # files are made pylint clean they should be added to the 395N/A# Runs lint on the extension module source code 1391N/A # Make string shell-friendly 1391N/A # assumes lint is on the $PATH 883N/A# Runs both C and Python lint 883N/A # Make string shell-friendly 1099N/A # PRIVATE_BUILD set in the environment tells us to put the build 1099N/A # directory into the .pyc files, rather than the final 1099N/A # This is used when installing scripts, below, but it isn't a 1099N/A # standard distutils variable. 465N/A """At the end of the install function, we need to rename some 395N/A files because distutils provides no way to rename files as they 395N/A are placed in their install locations. 465N/A for e
in [
".py",
".pyc"]:
1208N/A """Remove the target files prior to the standard install_lib procedure 1208N/A if the build_py module has determined that they've actually changed. 1208N/A This may be needed when a module's timestamp goes backwards in time, if 1208N/A a working-directory change is reverted, or an older changeset is checked 1391N/A """Enhance the standard install_data subcommand to take not only a list 1391N/A of filenames, but a list of source and destination filename tuples, for 1391N/A the cases where a filename needs to be renamed between the two 1099N/A # Don't bother making this generic for the one symlink. 849N/A "install failed and returned %d." %
ret 849N/A """A clone of distutils.file_util._copy_file_contents() that strips the 383N/A # Match the lines between and including the CDDL header signposts, as 849N/A # well as empty comment lines before and after, if they exist. 422N/A# Make file_util use our version of _copy_file_contents 1099N/A (
"file=",
"f",
"source file to copy"),
1099N/A (
"dest=",
"d",
"destination directory"),
290N/A (
"mode=",
"m",
"file mode"),
448N/A """ Run python's compiler over the file, and discard the results. 448N/A Arrange to generate an exception if the file does not compile. 448N/A This is needed because distutil's own use of pycompile (in the 448N/A distutils.utils module) is broken, and doesn't stop on error. """ 2180N/A # Assume it's a tuple of (filename, lineno, col, code) 2180N/A# On Solaris, ld inserts the full argument to the -o option into the symbol 2180N/A# table. This means that the resulting object will be different depending on 2180N/A# the path at which the workspace lives, and not just on the interesting content 2180N/A# In order to work around that bug (7076871), we create a new compiler class 2180N/A# that looks at the argument indicating the output file, chdirs to its 2180N/A# directory, and runs the real link with the output file set to just the base 2180N/A# Unfortunately, distutils isn't too customizable in this regard, so we have to 2180N/A# twiddle with a couple of the names in the distutils.ccompiler namespace: we 2180N/A# have to add a new entry to the compiler_class dict, and we have to override 2180N/A# the new_compiler() function to point to our own. Luckily, our copy of 2180N/A# new_compiler() gets to be very simple, since we always know what we want to 1632N/A 'unixccompiler',
'MyUnixCCompiler',
1632N/A 'standard Unix-style compiler with a link stage modified for Solaris' 395N/A # Gather the timestamps of the .py files in the gate, so we can 395N/A # force the mtimes of the built and delivered copies to be 395N/A # consistent across builds, causing their corresponding .pyc 395N/A # files to be unchanged unless the .py file content changed. 290N/A # override the build_module method to do VERSION substitution on 395N/A # Grab the previously-built version out of the build 395N/A # If the versions haven't changed, there's no need to 691N/A print "doing version substitution: ", v
395N/A # Will raise a DistutilsError on failure. 395N/A # If the timestamp on the source file (coming from mercurial if 395N/A # unchanged, or from the filesystem if changed) doesn't match 395N/A # the filesystem timestamp on the destination, then force the 395N/A # 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)
"""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"),
(
"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 [(
'po/%s.mo' %
locale,
'pkg.mo')])
for t
in 'HighContrast',
'HighContrastInverse',
'':
for px in '24',
'36',
'48':
for n
in (
'filter_all',
'filter_selected',
'progress_checkmark',
'selection',
'status_checkmark',
'status_installed',
'status_newupdate',
'status_notinstalled')
for n
in (
'pm-install_update',
'pm-refresh',
'pm-remove',
'pm-update_all')
# These two icons don't fit any patterns. # 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