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] 3313N/A# Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. 2828N/A# the version of pylint that we must have in order to run the pylint checks. 534N/A# Unbuffer stdout and stderr. This helps to ensure that subprocess output 534N/A# is properly interleaved with output from this program. 3339N/A# Can't have unbuffered text I/O in Python 3. This doesn't quite matter. 3117N/A# Extract Python minor version. 1674N/A# A list of source, destination tuples of modules which should be hardlinked 1674N/A# together if the os supports it and otherwise copied. 2867N/A 'svc-pkg-repositories-setup'],
3136N/A # install same set of files in "en/" in "__LOCALE__/ as well" 2688N/A # for localizable file package (regarding themes, install 2852N/A# The apache-based depot includes an shtml file we add to the resource dir 2535N/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()
2339N/A# Runs lint on the extension module source code 2339N/A # Make string shell-friendly 2828N/A """Compare the installed version against the version 2828N/A we require to build with, returning False if the version 2828N/A is too old. It's tempting to use pkg.version.Version 2828N/A here, but since that's a build artifact, we'll do it 2828N/A # if the lists are of different lengths, we just 2828N/A # compare with the precision we have. 2828N/A # if we somehow get non-numeric version 2828N/A # components, we ignore them. 2828N/A # it's fine to default to the required version - the build will 2828N/A # break if the installed version is incompatible and $PYLINT_VER 2828N/A "$PKG_SKIP_PYLINT was set")
3158N/A "installed version {0} is older than version {1}".
format(
2339N/A # Insert tests directory onto sys.path so any custom checkers 2339N/A # assumes pylint is accessible on the sys.path 2339N/A # Unfortunately, pylint seems pretty fragile and will crash if 2339N/A # we try to run it over all the current pkg source. Hence for 2339N/A # now we only run it over a subset of the source. As source 2339N/A # files are made pylint clean they should be added to the 3253N/A # In Python 3 porting mode, all checkers will be 3253N/A # disabled and only messages emitted by the porting 3253N/A # checker will be displayed. Therefore we need to run 3253N/A # We check all Python files in the gate. 290N/A# Runs lint on the extension module source code 290N/A # Make string shell-friendly 2674N/A [
'-D_FILE_OFFSET_BITS=64'] + \
2674N/A [
'-D_FILE_OFFSET_BITS=64'] + \
2674N/A [
'-D_FILE_OFFSET_BITS=64'] + \
3026N/A [
'-D_FILE_OFFSET_BITS=64'] + \
3053N/A [
'-D_FILE_OFFSET_BITS=64'] + \
2339N/A# Runs both C and Python lint 2339N/A # Make string shell-friendly 506N/A # PRIVATE_BUILD set in the environment tells us to put the build 506N/A # directory into the .pyc files, rather than the final 506N/A # installation directory. 506N/A # This is used when installing scripts, below, but it isn't a 506N/A # standard distutils variable. 2535N/A """At the end of the install function, we need to rename some 2535N/A files because distutils provides no way to rename files as they 2535N/A are placed in their install locations. 3203N/A # XXX Uncomment it when we need to deliver python 3.4 version 3203N/A # Don't install the scripts for python 3.4. 395N/A # make scripts executable 2561N/A """Remove the target files prior to the standard install_lib procedure 2561N/A if the build_py module has determined that they've actually changed. 2561N/A This may be needed when a module's timestamp goes backwards in time, if 2561N/A a working-directory change is reverted, or an older changeset is checked 2535N/A """Enhance the standard install_data subcommand to take not only a list 2535N/A of filenames, but a list of source and destination filename tuples, for 2535N/A the cases where a filename needs to be renamed between the two 2688N/A # use temp environment modified with the given dict 2688N/A # just use environment of this (parent) process as is 2688N/A # just use stderr of this (parent) process 2535N/A """A clone of distutils.file_util._copy_file_contents() that strips the 2597N/A CDDL text. For Python files, we replace the CDDL text with an equal 2597N/A number of empty comment lines so that line numbers match between the 2597N/A source and destination files.""" 2535N/A # Match the lines between and including the CDDL header signposts, as 2535N/A # well as empty comment lines before and after, if they exist. 3246N/A # Look for shebang line to replace with arch-specific Python executable. 2597N/A # replace the CDDL expression 2597N/A # with the same number of empty 2597N/A # comment lines as the cddl_re 2535N/A# Make file_util use our version of _copy_file_contents 2688N/A """Check if scope of localization looks up-to-date or possibly not, 2688N/A actual source files (e.g. .py) detected. 3143N/A print(
"New file(s) with translatable strings detected:",
3143N/APlease evaluate whether any of the above file(s) needs localization. 2688N/A """Generate pkg.pot by extracting localizable strings from source 2826N/A """Checks for common i18n messaging bugs in the source.""" 2826N/A # A list of the i18n errors we check for in the code 2826N/A # This checks that messages with multiple parameters are always 3158N/A # written using "{name}" format, rather than just "{0}" 2826N/A "format string with unnamed arguments cannot be properly localized" 3143N/AThe following i18n errors were detected and should be corrected: 2688N/A """create XML help for localization, where French part of legalnotice 2688N/A # indicates currently in French part of legalnotice 2688N/A # reached end of legalnotice 2688N/A """Input is English XML file. Output is pkg_help.pot, message 2688N/A source for next translation update. 2688N/A """Input is English XML file and <lang>.po file (which contains 2688N/A translations). Output is translated XML file. 2535N/A (
"file=",
"f",
"source file to copy"),
2535N/A (
"dest=",
"d",
"destination directory"),
2535N/A (
"mode=",
"m",
"file mode"),
3143N/A print(
"ERROR: unable to obtain mercurial version",
849N/A """ Run python's compiler over the file, and discard the results. 849N/A Arrange to generate an exception if the file does not compile. 849N/A This is needed because distutil's own use of pycompile (in the 849N/A distutils.utils module) is broken, and doesn't stop on error. """ 2242N/A # Assume it's a tuple of (filename, lineno, col, code) 2508N/A# On Solaris, ld inserts the full argument to the -o option into the symbol 2508N/A# table. This means that the resulting object will be different depending on 2508N/A# the path at which the workspace lives, and not just on the interesting content 2508N/A# In order to work around that bug (7076871), we create a new compiler class 2508N/A# that looks at the argument indicating the output file, chdirs to its 2508N/A# directory, and runs the real link with the output file set to just the base 2508N/A# Unfortunately, distutils isn't too customizable in this regard, so we have to 2508N/A# twiddle with a couple of the names in the distutils.ccompiler namespace: we 2508N/A# have to add a new entry to the compiler_class dict, and we have to override 2508N/A# the new_compiler() function to point to our own. Luckily, our copy of 2508N/A# new_compiler() gets to be very simple, since we always know what we want to 2508N/A 'unixccompiler',
'MyUnixCCompiler',
2508N/A 'standard Unix-style compiler with a link stage modified for Solaris' 2677N/A # store our 64-bit extensions elsewhere 2508N/A # Gather the timestamps of the .py files in the gate, so we can 2508N/A # force the mtimes of the built and delivered copies to be 2508N/A # consistent across builds, causing their corresponding .pyc 2508N/A # files to be unchanged unless the .py file content changed. 3143N/A print(
"ERROR: unable to gather .py timestamps",
3261N/A # Before building extensions, we need to generate .c files 3261N/A # for the C extension modules by running the CFFI build 2535N/A # override the build_module method to do VERSION substitution on 422N/A # Grab the previously-built version out of the build 422N/A # If the versions haven't changed, there's no need to 3143N/A print(
"doing version substitution: ", v)
849N/A # Will raise a DistutilsError on failure. 2508N/A # If the timestamp on the source file (coming from mercurial if 2508N/A # unchanged, or from the filesystem if changed) doesn't match 2508N/A # the filesystem timestamp on the destination, then force the 2508N/A # copy to make sure the right data is in place. 2561N/A # Force a copy of the file if the source timestamp is different 2561N/A # from that of the destination, not just if it's newer. This 2561N/A # allows timestamps in the working directory to regress (for 2561N/A # instance, following the reversion of a change). 2508N/A # If we copied the file, then we need to go and readjust the 2508N/A # timestamp on the file to match what we have in our database. 2561N/A # Save the filename aside for our version of install_lib. 3139N/A """Convert a manpage output path to the directory where its source lives.""" 3139N/A """Convert XML manpages to ROFF for delivery. 3139N/A The input should be a list of the output file paths. The corresponding 3139N/A inputs will be generated from this. We do it in this way so that we can 3139N/A share the paths with the install code. 3139N/A All paths should have a common manpath root. In particular, pages 3139N/A belonging to different localizations should be run through this function 3139N/A # Get the output dir by removing the filename and the manX 2535N/A # As a subclass of distutils.cmd.Command, these methods are required to 2535N/A # Anything that gets created here should get deleted in 2688N/A # generate pkg.pot for next translation 2535N/A """Remove a file without caring whether it exists.""" 3261N/A # These files generated by the CFFI build scripts are useless 3261N/A # at this point, therefore clean them up. 3261N/A print(
"deleting temporary files generated by CFFI")
1101N/A # list of options stored in initialize_options below. The first entry 1101N/A # in each tuple must be the exact name of a member variable. 1715N/A (
"archivedir=",
'a',
"archive failed tests <dir>"),
1513N/A (
"baselinefile=",
'b',
"baseline file <file>"),
1513N/A (
"coverage",
"c",
"collect code coverage data"),
448N/A (
"genbaseline",
'g',
"generate test baseline"),
1513N/A (
"only=",
"o",
"only <regex>"),
448N/A (
"parseable",
'p',
"parseable output"),
2272N/A (
"port=",
"z",
"lowest port to start a depot on"),
1101N/A (
"timing",
"t",
"timing file <file>"),
1513N/A (
"verbosemode",
'v',
"run tests in verbose mode"),
1715N/A (
"stoponerr",
'x',
"stop when a baseline mismatch occurs"),
1715N/A (
"debugoutput",
'd',
"emit debugging output"),
1716N/A (
"showonexpectedfail",
'f',
1715N/A "show all failure info, even for expected fails"),
1715N/A (
"startattest=",
's',
"start at indicated test"),
2499N/A (
"jobs=",
'j',
"number of parallel processes to use"),
2499N/A (
"quiet",
"q",
"use the dots as the output format"),
3049N/A (
"livesystem",
'l',
"run tests on live system"),
2698N/A # This class wraps the distutils Extension class, allowing us to set 2698N/A # build_64 in the object constructor instead of being forced to add it 2698N/A # after the object has been created. 3339N/A # 'name' and the item in 'sources' must be a string literal 290N/A# These are set to real values based on the platform, down below 383N/A# all builds of IPS should have manpages 395N/A # Solaris-specific extensions are added here 2688N/A # install localizable .xml and its .pot file to put into localizable file package 2688N/A # install English .pot file to put into localizable file package 3313N/A # install English manpage sources to put into localizable file package 395N/A # Unix platforms which the elf extension has been ported to 395N/A # are specified here, so they are built automatically 395N/A # Solaris has built-in md library and Solaris-specific arch extension 395N/A # All others use OpenSSL and cross-platform arch module 3339N/A 'Programming Language :: Python :: 2',
3245N/A 'Programming Language :: Python :: 2.7',
3339N/A 'Programming Language :: Python :: 3',
3339N/A 'Programming Language :: Python :: 3.4',