src/setup.py
author Brock Pytlik <bpytlik@sun.com>
Thu, 16 Jul 2009 19:21:13 -0700
changeset 1231 f7b99e8118d2
parent 1228 07ef6e279231
child 1265 c700981b0af2
permissions -rw-r--r--
9290 need a way to find the file dependencies of a package 9908 variant.py should be moved from client specific code
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
409
713e20963dc2 2314 shebang lines should use minimum python version
Shawn Walker <swalker@opensolaris.org>
parents: 395
diff changeset
     1
#!/usr/bin/python2.4
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     2
#
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     3
# CDDL HEADER START
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     4
#
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     8
#
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    12
# and limitations under the License.
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    13
#
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    19
#
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    20
# CDDL HEADER END
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    21
#
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
    22
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
    23
# Use is subject to license terms.
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
    24
#
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    25
883
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
    26
import errno
454
c27abbc11c8c 2811 clobber doesn't clobber all versions of dependencies
Shawn Walker <shawn.walker@sun.com>
parents: 452
diff changeset
    27
import fnmatch
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    28
import os
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
    29
import platform
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    30
import stat
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    31
import sys
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    32
import shutil
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
    33
import re
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    34
import subprocess
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
    35
import tarfile
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    36
import tempfile
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
    37
import urllib
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
    38
import py_compile
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    39
import sha
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    40
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
    41
from distutils.errors import DistutilsError
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    42
from distutils.core import setup, Extension
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    43
from distutils.cmd import Command
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    44
from distutils.command.install import install as _install
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    45
from distutils.command.build import build as _build
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
    46
from distutils.command.build_py import build_py as _build_py
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    47
from distutils.command.bdist import bdist as _bdist
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    48
from distutils.command.clean import clean as _clean
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    49
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    50
from distutils.sysconfig import get_python_inc
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    51
import distutils.file_util as file_util
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    52
import distutils.dir_util as dir_util
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    53
import distutils.util as util
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
    54
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    55
# 3rd party software required for the build
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    56
CP = 'CherryPy'
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    57
CPIDIR = 'cherrypy'
801
cf03bb9d909e 5333 upgrade to cherrypy 3.1.1
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 742
diff changeset
    58
CPVER = '3.1.1'
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    59
CPARC = '%s-%s.tar.gz' % (CP, CPVER)
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    60
CPDIR = '%s-%s' % (CP, CPVER)
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    61
CPURL = 'http://download.cherrypy.org/cherrypy/%s/%s' % (CPVER, CPARC)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    62
CPHASH = '0a8aace00ea28adc05edd41e20dd910042e6d265'
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    63
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    64
PO = 'pyOpenSSL'
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    65
POIDIR = 'OpenSSL'
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    66
POVER = '0.7'
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    67
POARC = '%s-%s.tar.gz' % (PO, POVER)
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    68
PODIR = '%s-%s' % (PO, POVER)
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    69
POURL = 'http://downloads.sourceforge.net/pyopenssl/%s' % (POARC)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    70
POHASH = 'bd072fef8eb36241852d25a9161282a051f0a63e'
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
    71
708
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    72
FL = 'figleaf'
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    73
FLIDIR = 'figleaf'
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    74
FLVER = 'latest'
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    75
FLARC = '%s-%s.tar.gz' % (FL, FLVER)
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    76
FLDIR = '%s-%s' % (FL, FLVER)
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    77
FLURL = 'http://darcs.idyll.org/~t/projects/%s' % FLARC
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    78
# No hash, since we always fetch the latest
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    79
FLHASH = None
708
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
    80
742
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    81
MAKO = 'Mako'
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    82
MAKOIDIR = 'mako'
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    83
MAKOVER = '0.2.2'
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    84
MAKOARC = '%s-%s.tar.gz' % (MAKO, MAKOVER)
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    85
MAKODIR = '%s-%s' % (MAKO, MAKOVER)
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    86
MAKOURL = 'http://www.makotemplates.org/downloads/%s' % (MAKOARC)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    87
MAKOHASH = '85c04ab3a6a26a1cab47067449712d15a8b29790'
742
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
    88
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    89
PLY = 'ply'
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    90
PLYIDIR = 'ply'
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    91
PLYVER = '3.1'
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    92
PLYARC = '%s-%s.tar.gz' % (PLY, PLYVER)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    93
PLYDIR = '%s-%s' % (PLY, PLYVER)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    94
PLYURL = 'http://www.dabeaz.com/ply/%s' % (PLYARC)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
    95
PLYHASH = '38efe9e03bc39d40ee73fa566eb9c1975f1a8003'
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents: 883
diff changeset
    96
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
    97
PC = 'pycurl'
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
    98
PCIDIR = 'pycurl'
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
    99
PCVER = '7.19.0'
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   100
PCARC = '%s-%s.tar.gz' % (PC, PCVER)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   101
PCDIR = '%s-%s' % (PC, PCVER)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   102
PCURL = 'http://pycurl.sourceforge.net/download/%s' % PCARC
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   103
PCHASH = '3fb59eca1461331bb9e9e8d6fe3b23eda961a416'
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   104
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   105
osname = platform.uname()[0].lower()
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   106
ostype = arch = 'unknown'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   107
if osname == 'sunos':
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   108
        arch = platform.processor()
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   109
        ostype = "posix"
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   110
elif osname == 'linux':
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   111
        arch = "linux_" + platform.machine()
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   112
        ostype = "posix"
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   113
elif osname == 'windows':
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   114
        arch = osname
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   115
        ostype = "windows"
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   116
elif osname == 'darwin':
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   117
        arch = osname
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   118
        ostype = "posix"
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   119
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   120
pwd = os.path.normpath(sys.path[0])
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   121
534
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   122
#
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   123
# Unbuffer stdout and stderr.  This helps to ensure that subprocess output
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   124
# is properly interleaved with output from this program.
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   125
#
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   126
sys.stdout = os.fdopen(sys.stdout.fileno(), "w", 0)
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   127
sys.stderr = os.fdopen(sys.stderr.fileno(), "w", 0)
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   128
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   129
dist_dir = os.path.normpath(os.path.join(pwd, os.pardir, "proto", "dist_" + arch))
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   130
build_dir = os.path.normpath(os.path.join(pwd, os.pardir, "proto", "build_" + arch))
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   131
if "ROOT" in os.environ and os.environ["ROOT"] != "":
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   132
        root_dir = os.environ["ROOT"]
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   133
else:
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   134
        root_dir = os.path.normpath(os.path.join(pwd, os.pardir, "proto", "root_" + arch))
534
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   135
pkgs_dir = os.path.normpath(os.path.join(pwd, os.pardir, "packages", arch))
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   136
extern_dir = os.path.normpath(os.path.join(pwd, "extern"))
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   137
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   138
cacert_dir = os.path.normpath(os.path.join(pwd, "cacert"))
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   139
cacert_install_dir = 'usr/share/pkg/cacert'
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   140
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   141
py_install_dir = 'usr/lib/python2.4/vendor-packages'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   142
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   143
scripts_dir = 'usr/bin'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   144
lib_dir = 'usr/lib'
661
edf14bae4465 2717 pkg.depotd: need smf support for depot mode options
Brock Pytlik <bpytlik@sun.com>
parents: 613
diff changeset
   145
svc_method_dir = 'lib/svc/method'
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   146
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   147
man1_dir = 'usr/share/man/cat1'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   148
man1m_dir = 'usr/share/man/cat1m'
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   149
man5_dir = 'usr/share/man/cat5'
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   150
resource_dir = 'usr/share/lib/pkg'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   151
smf_dir = 'var/svc/manifest/application'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   152
zones_dir = 'etc/zones'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   153
brand_dir = 'usr/lib/brand/ipkg'
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   154
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   155
scripts_sunos = {
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   156
        scripts_dir: [
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   157
                ['client.py', 'pkg'],
1231
f7b99e8118d2 9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents: 1228
diff changeset
   158
                ['pkgdep.py', 'pkgdep'],
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   159
                ['publish.py', 'pkgsend'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   160
                ['pull.py', 'pkgrecv'],
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents: 422
diff changeset
   161
                ['packagemanager.py', 'packagemanager'],
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 954
diff changeset
   162
                ['updatemanager.py', 'pm-updatemanager'],
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   163
                ],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   164
        lib_dir: [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   165
                ['depot.py', 'pkg.depotd'],
578
da257532b3f2 3816 RFE UpdateManager notify users of repo updates
John Rice <john.rice@sun.com>
parents: 534
diff changeset
   166
                ['updatemanagernotifier.py', 'updatemanagernotifier'],
1228
07ef6e279231 9852 UMN and PM check for updates should use plan_update_all
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1208
diff changeset
   167
                ['checkforupdates.py', 'pm-checkforupdates'],
1172
fc39dcc70f84 9574 Package Manager should use user's GNOME proxy settings
Padraig O'Briain <padraig.obriain@sun.com>
parents: 1101
diff changeset
   168
                ['launch.py', 'pm-launch'],
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   169
                ],
661
edf14bae4465 2717 pkg.depotd: need smf support for depot mode options
Brock Pytlik <bpytlik@sun.com>
parents: 613
diff changeset
   170
        svc_method_dir: [
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   171
                ['svc/svc-pkg-depot', 'svc-pkg-depot'],
661
edf14bae4465 2717 pkg.depotd: need smf support for depot mode options
Brock Pytlik <bpytlik@sun.com>
parents: 613
diff changeset
   172
                ],
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   173
        }
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   174
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   175
scripts_windows = {
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   176
        scripts_dir: [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   177
                ['client.py', 'client.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   178
                ['publish.py', 'publish.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   179
                ['pull.py', 'pull.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   180
                ['scripts/pkg.bat', 'pkg.bat'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   181
                ['scripts/pkgsend.bat', 'pkgsend.bat'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   182
                ['scripts/pkgrecv.bat', 'pkgrecv.bat'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   183
                ],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   184
        lib_dir: [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   185
                ['depot.py', 'depot.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   186
                ['scripts/pkg.depotd.bat', 'pkg.depotd.bat'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   187
                ],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   188
        }
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   189
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   190
scripts_other_unix = {
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   191
        scripts_dir: [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   192
                ['client.py', 'client.py'],
1231
f7b99e8118d2 9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents: 1228
diff changeset
   193
                ['pkgdep.py', 'pkgdep'],
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   194
                ['pull.py', 'pull.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   195
                ['publish.py', 'publish.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   196
                ['scripts/pkg.sh', 'pkg'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   197
                ['scripts/pkgsend.sh', 'pkgsend'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   198
                ['scripts/pkgrecv.sh', 'pkgrecv'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   199
                ],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   200
        lib_dir: [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   201
                ['depot.py', 'depot.py'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   202
                ['scripts/pkg.depotd.sh', 'pkg.depotd'],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   203
                ],
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   204
        }
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   205
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   206
# indexed by 'osname'
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   207
scripts = {
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   208
        "sunos": scripts_sunos,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   209
        "linux": scripts_other_unix,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   210
        "windows": scripts_windows,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   211
        "darwin": scripts_other_unix,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   212
        "unknown": scripts_sunos,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   213
        }
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   214
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   215
man1_files = [
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 954
diff changeset
   216
        'man/packagemanager.1',
413
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   217
        'man/pkg.1',
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   218
        'man/pkgsend.1',
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   219
        'man/pkgrecv.1',
1024
e83271f2e133 7645 Man page required for Package Manager and Update Manager
Padraig O'Briain <padraig.obriain@sun.com>
parents: 954
diff changeset
   220
        'man/pm-updatemanager.1',
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   221
        ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   222
man1m_files = [
413
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   223
        'man/pkg.depotd.1m'
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   224
        ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   225
man5_files = [
413
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   226
        'man/pkg.5'
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   227
        ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   228
packages = [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   229
        'pkg',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   230
        'pkg.actions',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   231
        'pkg.bundle',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   232
        'pkg.client',
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   233
        'pkg.client.transport',
1231
f7b99e8118d2 9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents: 1228
diff changeset
   234
        'pkg.flavor',
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   235
        'pkg.portable',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   236
        'pkg.publish',
424
a767ef6bf887 2578 integrate packagemanager into ips gate
Danek Duvall <danek.duvall@sun.com>
parents: 422
diff changeset
   237
        'pkg.server'
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   238
        ]
742
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   239
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   240
web_files = []
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   241
for entry in os.walk("web"):
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   242
        web_dir, dirs, files = entry
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   243
        if not files:
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   244
                continue
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   245
        web_files.append((os.path.join(resource_dir, web_dir), [
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   246
            os.path.join(web_dir, f) for f in files
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   247
            if f != "Makefile"
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   248
            ]))
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   249
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   250
zones_files = [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   251
        'brand/SUNWipkg.xml',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   252
        ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   253
brand_files = [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   254
        'brand/config.xml',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   255
        'brand/platform.xml',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   256
        'brand/pkgcreatezone',
954
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   257
        'brand/attach',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   258
        'brand/clone',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   259
        'brand/detach',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   260
        'brand/prestate',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   261
        'brand/poststate',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   262
        'brand/query',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   263
        'brand/uninstall',
8614b0c63fb3 4771 zone operations fail with package inventory errors when authority changes
Dan Price <dp@eng.sun.com>
parents: 941
diff changeset
   264
        'brand/common.ksh',
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   265
        ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   266
smf_files = [
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   267
        'svc/pkg-server.xml',
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   268
        'svc/pkg-update.xml',
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   269
        ]
691
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   270
pspawn_srcs = [
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   271
        'modules/pspawn.c'
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   272
        ]
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   273
elf_srcs = [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   274
        'modules/elf.c',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   275
        'modules/elfextract.c',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   276
        'modules/liblist.c',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   277
        ]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   278
arch_srcs = [
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   279
        'modules/arch.c'
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   280
        ]
591
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   281
_actions_srcs = [
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   282
        'modules/actions/_actions.c'
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   283
        ]
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   284
include_dirs = [ 'modules' ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   285
lint_flags = [ '-u', '-axms', '-erroff=E_NAME_DEF_NOT_USED2' ]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   286
708
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   287
# Runs the test suite with the code coverage suite (figleaf) turned on, and
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   288
# outputs a coverage report.
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   289
# TODO: Make the cov report format an option (html, ast, cov, etc)
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   290
class cov_func(Command):
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   291
        description = "Runs figleaf code coverage suite"
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   292
        user_options = []
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   293
        def initialize_options(self):
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   294
                pass
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   295
        def finalize_options(self):
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   296
                pass
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   297
        def run(self):
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   298
                if not os.path.isdir(FLDIR):
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   299
                        install_sw(FL, FLVER, FLARC, FLDIR, FLURL, FLIDIR,
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   300
                            FLHASH)
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   301
                # Run the test suite with coverage enabled
708
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   302
                os.putenv('PYEXE', sys.executable)
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   303
                os.chdir(os.path.join(pwd, "tests"))
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   304
                # Reconstruct the cmdline and send that to run.py
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   305
                os.environ["PKGCOVERAGE"] = "1"
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   306
                cmd = [sys.executable, "run.py"]
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   307
                subprocess.call(cmd)
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   308
                print "Generating coverage report in directory: '%s/cov_report'" % \
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   309
                    pwd
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   310
                os.system("figleaf2html -d cov_report .figleaf")
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   311
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   312
# Runs lint on the extension module source code
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   313
class lint_func(Command):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   314
        description = "Runs various lint tools over IPS extension source code"
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   315
        user_options = []
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   316
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   317
        def initialize_options(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   318
                pass
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   319
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   320
        def finalize_options(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   321
                pass
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   322
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   323
        # Make string shell-friendly
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   324
        @staticmethod
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   325
        def escape(astring):
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   326
                return astring.replace(' ', '\\ ')
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   327
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   328
        def run(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   329
                # assumes lint is on the $PATH
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   330
                if osname == 'sunos' or osname == "linux":
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   331
                        archcmd = ['lint'] + lint_flags + ['-D_FILE_OFFSET_BITS=64'] + \
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   332
                            ["%s%s" % ("-I", k) for k in include_dirs] + \
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   333
                            ['-I' + self.escape(get_python_inc())] + \
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   334
                            arch_srcs
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   335
                        elfcmd = ['lint'] + lint_flags + \
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   336
                            ["%s%s" % ("-I", k) for k in include_dirs] + \
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   337
                            ['-I' + self.escape(get_python_inc())] + \
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   338
                            ["%s%s" % ("-l", k) for k in elf_libraries] + \
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   339
                            elf_srcs
591
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   340
                        _actionscmd = ['lint'] + lint_flags + \
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   341
                            ["%s%s" % ("-I", k) for k in include_dirs] + \
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   342
                            ['-I' + self.escape(get_python_inc())] + \
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   343
                            _actions_srcs
691
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   344
                        pspawncmd = ['lint'] + lint_flags + ['-D_FILE_OFFSET_BITS=64'] + \
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   345
                            ["%s%s" % ("-I", k) for k in include_dirs] + \
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   346
                            ['-I' + self.escape(get_python_inc())] + \
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   347
                            pspawn_srcs
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   348
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   349
                        print(" ".join(archcmd))
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   350
                        os.system(" ".join(archcmd))
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   351
                        print(" ".join(elfcmd))
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   352
                        os.system(" ".join(elfcmd))
591
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   353
                        print(" ".join(_actionscmd))
dbe9236b0884 2686 action key/value pairs separated by tabs cause parsing problems
Danek Duvall <danek.duvall@sun.com>
parents: 578
diff changeset
   354
                        os.system(" ".join(_actionscmd))
691
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   355
                        print(" ".join(pspawncmd))
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   356
                        os.system(" ".join(pspawncmd))
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   357
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   358
                        proto = os.path.join(root_dir, py_install_dir)
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   359
                        sys.path.insert(0, proto)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   360
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   361
                        # Insert tests directory onto sys.path so any custom checkers
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   362
                        # can be found.
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   363
                        sys.path.insert(0, os.path.join(pwd, 'tests'))
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   364
                        print(sys.path)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   365
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   366
                # assumes pylint is accessible on the sys.path
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   367
                from pylint import lint
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   368
                scriptlist = [ 'setup.py' ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   369
                for d, m in scripts_sunos.items():
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   370
                        for a in m:
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   371
                                # specify the filenames of the scripts, in addition
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   372
                                # to the package names themselves
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   373
                                scriptlist.append(os.path.join(root_dir, d, a[1]))
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   374
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   375
                # For some reason, the load-plugins option, when used in the
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   376
                # rcfile, does not work, so we put it here instead, to load
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   377
                # our custom checkers.
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   378
                lint.Run(['--load-plugins=multiplatform', '--rcfile',
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   379
                          os.path.join(pwd, 'tests', 'pylintrc')] +
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   380
                          scriptlist + packages)
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   381
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   382
class install_func(_install):
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   383
        def initialize_options(self):
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   384
                _install.initialize_options(self)
506
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   385
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   386
                # PRIVATE_BUILD set in the environment tells us to put the build
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   387
                # directory into the .pyc files, rather than the final
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   388
                # installation directory.
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   389
                private_build = os.getenv("PRIVATE_BUILD", None)
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   390
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   391
                if private_build is None:
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   392
                        self.install_lib = py_install_dir
834
f8b3396500b3 4883 import failure for non-sunos platforms due to missing pspawn
Tom Mueller <Tom.Mueller@sun.com>
parents: 801
diff changeset
   393
                        self.install_data = os.path.sep
506
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   394
                        self.root = root_dir
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   395
                else:
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   396
                        self.install_lib = os.path.join(root_dir, py_install_dir)
513
4ddcb572f5d9 3330 smf manifest file in wrong location
Danek Duvall <danek.duvall@sun.com>
parents: 506
diff changeset
   397
                        self.install_data = root_dir
506
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   398
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   399
                # This is used when installing scripts, below, but it isn't a
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   400
                # standard distutils variable.
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   401
                self.root_dir = root_dir
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   402
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   403
        def run(self):
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   404
                """
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   405
                At the end of the install function, we need to rename some files
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   406
                because distutils provides no way to rename files as they are
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   407
                placed in their install locations.
883
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   408
                Also, make sure that cherrypy and other external dependencies
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   409
                are installed.
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   410
                """
413
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   411
                for f in man1_files + man1m_files + man5_files:
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   412
                        file_util.copy_file(f + ".txt", f, update=1)
3170bad6ceb7 2406 man pages are re-installed every time
Danek Duvall <danek.duvall@sun.com>
parents: 409
diff changeset
   413
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   414
                _install.run(self)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   415
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   416
                for d, files in scripts[osname].iteritems():
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   417
                        for (srcname, dstname) in files:
506
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   418
                                dst_dir = util.change_root(self.root_dir, d)
acc9011bd8d4 2754 incorrect paths and source snippets in development stack traces
Danek Duvall <danek.duvall@sun.com>
parents: 498
diff changeset
   419
                                dst_path = util.change_root(self.root_dir,
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   420
                                       os.path.join(d, dstname))
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   421
                                dir_util.mkpath(dst_dir, verbose = True)
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   422
                                file_util.copy_file(srcname, dst_path, update = True)
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   423
                                # make scripts executable
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   424
                                os.chmod(dst_path,
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   425
                                    os.stat(dst_path).st_mode
834
f8b3396500b3 4883 import failure for non-sunos platforms due to missing pspawn
Tom Mueller <Tom.Mueller@sun.com>
parents: 801
diff changeset
   426
                                    | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   427
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   428
                # Take cacerts in cacert_dir and install them in
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   429
                # proto-area-relative cacert_install_dir
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   430
                install_cacerts()
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   431
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   432
                install_sw(CP, CPVER, CPARC, CPDIR, CPURL, CPIDIR, CPHASH)
836
1800b2c96160 5599 Installing SUNWxvnc to a zone is not enough
David.Comay@Sun.COM
parents: 834
diff changeset
   433
		if "BUILD_PYOPENSSL" in os.environ and \
1800b2c96160 5599 Installing SUNWxvnc to a zone is not enough
David.Comay@Sun.COM
parents: 834
diff changeset
   434
                    os.environ["BUILD_PYOPENSSL"] != "":
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   435
                        #
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   436
                        # Include /usr/sfw/lib in the build environment
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   437
                        # to ensure that this builds and runs on older
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   438
                        # nevada builds, before openssl moved out of /usr/sfw.
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   439
                        #
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   440
                        saveenv = os.environ.copy()
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   441
                        if osname == "sunos":
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   442
                                os.environ["CFLAGS"] = "-I/usr/sfw/include " + \
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   443
                                    os.environ.get("CFLAGS", "")
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   444
                                os.environ["LDFLAGS"] = \
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   445
                                    "-L/usr/sfw/lib -R/usr/sfw/lib " + \
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   446
                                    os.environ.get("LDFLAGS", "")
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   447
                        install_sw(PO, POVER, POARC, PODIR, POURL, POIDIR,
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   448
                            POHASH)
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   449
                        os.environ = saveenv
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   450
                install_sw(MAKO, MAKOVER, MAKOARC, MAKODIR, MAKOURL, MAKOIDIR,
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   451
                    MAKOHASH)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   452
                install_sw(PLY, PLYVER, PLYARC, PLYDIR, PLYURL, PLYIDIR,
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   453
                    PLYHASH)
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   454
                install_sw(PC, PCVER, PCARC, PCDIR, PCURL, PCIDIR, PCHASH)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   455
883
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   456
                # Remove some bits that we're not going to package, but be sure
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   457
                # not to complain if we try to remove them twice.
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   458
                def onerror(func, path, exc_info):
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   459
                        if exc_info[1].errno != errno.ENOENT:
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   460
                                raise
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   461
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   462
                for dir in ("cherrypy/scaffold", "cherrypy/test",
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   463
                    "cherrypy/tutorial"):
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   464
                        shutil.rmtree(os.path.join(root_dir, py_install_dir, dir),
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   465
                            onerror=onerror)
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   466
                try:
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   467
                        os.remove(os.path.join(root_dir, "usr/bin/mako-render"))
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   468
                except EnvironmentError, e:
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   469
                        if e.errno != errno.ENOENT:
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   470
                                raise
77885b2adc42 5539 SUNWpython-mako should deliver egg info
Danek Duvall <danek.duvall@sun.com>
parents: 849
diff changeset
   471
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   472
def hash_sw(swname, swarc, swhash):
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   473
        if swhash == None:
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   474
                return True
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   475
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   476
        print "checksumming %s" % swname
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   477
        hash = sha.new()
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   478
        f = open(swarc, 'r')
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   479
        while True:
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   480
                data = f.read(65536)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   481
                if data == "":
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   482
                        break
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   483
                hash.update(data)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   484
        f.close()
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   485
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   486
        if hash.hexdigest() == swhash:
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   487
                return True
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   488
        else:
1208
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   489
                print >> sys.stderr, "bad checksum! %s != %s" % \
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   490
                    (swhash, hash.hexdigest())
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   491
                return False
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   492
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   493
def install_cacerts():
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   494
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   495
        findir = os.path.join(root_dir, cacert_install_dir)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   496
        dir_util.mkpath(findir, verbose = True)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   497
        for f in os.listdir(cacert_dir):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   498
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   499
                # Copy certificate
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   500
                srcname = os.path.normpath(os.path.join(cacert_dir, f))
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   501
                dn, copied = file_util.copy_file(srcname, findir, update = True)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   502
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   503
                if not copied:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   504
                        continue
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   505
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   506
                # Call openssl to create hash symlink
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   507
                cmd = ["/usr/bin/openssl", "x509", "-noout", "-hash", "-in",
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   508
                    srcname]
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   509
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   510
                p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   511
                hashval = p.stdout.read()
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   512
                p.wait()
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   513
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   514
                hashval = hashval.strip()
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   515
                hashval += ".0" 
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   516
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   517
                hashpath = os.path.join(findir, hashval)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   518
                if os.path.exists(hashpath):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   519
                        os.unlink(hashpath)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   520
                os.symlink(f, hashpath)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   521
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   522
def install_sw(swname, swver, swarc, swdir, swurl, swidir, swhash):
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   523
        swarc = os.path.join(extern_dir, swarc)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   524
        swdir = os.path.join(extern_dir, swdir)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   525
        if not os.path.exists(extern_dir):
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   526
                os.mkdir(extern_dir)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   527
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   528
        if not os.path.exists(swarc):
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   529
                print "downloading %s" % swname
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   530
                try:
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   531
                        fname, hdr = urllib.urlretrieve(swurl, swarc)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   532
                except IOError:
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   533
                        pass
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   534
                if not os.path.exists(swarc) or \
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   535
                    (hdr.gettype() != "application/x-gzip" and
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   536
                     hdr.gettype() != "application/x-tar"):
1208
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   537
                        print >> sys.stderr, "Unable to retrieve %s.\n" \
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   538
                            "Please retrieve the file " \
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   539
                            "and place it at: %s\n" % (swurl, swarc)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   540
                        # remove a partial download or error message from proxy
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   541
                        remove_sw(swname)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   542
                        sys.exit(1)
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   543
        if not os.path.exists(swdir):
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   544
                if not hash_sw(swname, swarc, swhash):
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   545
                        sys.exit(1)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   546
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   547
                print "unpacking %s" % swname
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   548
                tar = tarfile.open(swarc)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   549
                # extractall doesn't exist until python 2.5
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   550
                for m in tar.getmembers():
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   551
                        tar.extract(m, extern_dir)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   552
                tar.close()
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   553
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   554
        # If there are patches, apply them now.
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   555
        patchdir = os.path.join("patch", swname)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   556
        already_patched = os.path.join(swdir, ".patched")
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   557
        if os.path.exists(patchdir) and not os.path.exists(already_patched):
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   558
                patches = os.listdir(patchdir)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   559
                for p in patches:
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   560
                        patchpath = os.path.join(os.path.pardir,
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   561
                            os.path.pardir, patchdir, p)
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   562
                        print "Applying %s to %s" % (p, swname)
1208
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   563
                        args = ['patch', '-d', swdir, '-i', patchpath, '-p0']
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   564
                        ret = subprocess.Popen(args).wait()
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   565
                        if ret != 0:
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   566
                                print >> sys.stderr, \
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   567
                                    "patch failed and returned %d." % ret
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   568
                                print >> sys.stderr, \
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   569
                                    "Command was: %s" % " ".join(args)
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   570
                                sys.exit(1)
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   571
                file(already_patched, "w").close()
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1172
diff changeset
   572
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   573
        swinst_dir = os.path.join(root_dir, py_install_dir, swidir)
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   574
        if not os.path.exists(swinst_dir):
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   575
                print "installing %s" % swname
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   576
                args = ['python', 'setup.py', 'install',
498
e1c077b81de6 3135 SUNWpython-cherrypy delivers pyc files with embedded gate path
Danek Duvall <danek.duvall@sun.com>
parents: 465
diff changeset
   577
                    '--root=%s' % root_dir,
e1c077b81de6 3135 SUNWpython-cherrypy delivers pyc files with embedded gate path
Danek Duvall <danek.duvall@sun.com>
parents: 465
diff changeset
   578
                    '--install-lib=%s' % py_install_dir,
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   579
                    '--install-data=%s' % py_install_dir]
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   580
                ret = subprocess.Popen(args, cwd = swdir).wait()
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   581
                if ret != 0:
1208
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   582
                        print >> sys.stderr, \
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   583
                            "install failed and returned %d." % ret
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   584
                        print >> sys.stderr, \
9d8a558cae2d 9901 Patch failure should stop build
johansen <johansen@sun.com>
parents: 1201
diff changeset
   585
                            "Command was: %s" % " ".join(args)
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   586
                        sys.exit(1)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   587
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   588
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   589
def remove_sw(swname):
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   590
        print("deleting %s" % swname)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   591
        for file in os.listdir(extern_dir):
465
44fddb622fe4 2818 We should include pyOpenSSL in the gate
Brad Hall <bhall@eng.sun.com>
parents: 454
diff changeset
   592
                if fnmatch.fnmatch(file, "%s*" % swname):
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   593
                        fpath = os.path.join(extern_dir, file)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   594
                        if os.path.isfile(fpath):
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   595
                                os.unlink(fpath)
454
c27abbc11c8c 2811 clobber doesn't clobber all versions of dependencies
Shawn Walker <shawn.walker@sun.com>
parents: 452
diff changeset
   596
                        else:
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   597
                                shutil.rmtree(fpath, True)
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   598
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   599
class build_func(_build):
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   600
        def initialize_options(self):
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   601
                _build.initialize_options(self)
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   602
                self.build_base = build_dir
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   603
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   604
def get_hg_version():
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   605
        try:
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   606
                p = subprocess.Popen(['hg', 'id', '-i'], stdout = subprocess.PIPE)
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   607
                return p.communicate()[0].strip()
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   608
        except OSError:
384
9d4746e5dd3e 115 pkg needs to not have a cow on a SIGPIPE
Shawn Walker <swalker@opensolaris.org>
parents: 383
diff changeset
   609
                print >> sys.stderr, "ERROR: unable to obtain mercurial version"
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   610
                return "unknown"
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   611
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   612
def syntax_check(filename):
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   613
        """ Run python's compiler over the file, and discard the results.
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   614
            Arrange to generate an exception if the file does not compile.
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   615
            This is needed because distutil's own use of pycompile (in the
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   616
            distutils.utils module) is broken, and doesn't stop on error. """
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   617
        try:
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   618
                py_compile.compile(filename, os.devnull, doraise=True)
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   619
        except py_compile.PyCompileError, e:
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   620
                raise DistutilsError("%s: failed syntax check: %s" %
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   621
                    (filename, e))
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   622
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   623
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   624
class build_py_func(_build_py):
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   625
        # override the build_module method to do VERSION substitution on pkg/__init__.py
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   626
        def build_module (self, module, module_file, package):
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   627
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   628
                if module == "__init__" and package == "pkg":
422
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   629
                        versionre = '(?m)^VERSION[^"]*"([^"]*)"'
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   630
                        # Grab the previously-built version out of the build
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   631
                        # tree.
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   632
                        try:
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   633
                                ocontent = \
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   634
                                    file(self.get_module_outfile(self.build_lib,
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   635
                                        [package], module)).read()
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   636
                                ov = re.search(versionre, ocontent).group(1)
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   637
                        except IOError:
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   638
                                ov = None
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   639
                        v = get_hg_version()
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   640
                        vstr = 'VERSION = "%s"' % v
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   641
                        # If the versions haven't changed, there's no need to
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   642
                        # recompile.
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   643
                        if v == ov:
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   644
                                return
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   645
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   646
                        mcontent = file(module_file).read()
422
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   647
                        mcontent = re.sub(versionre, vstr, mcontent)
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   648
                        tmpfd, tmp_file = tempfile.mkstemp()
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   649
                        os.write(tmpfd, mcontent)
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   650
                        os.close(tmpfd)
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   651
                        print "doing version substitution: ", v
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   652
                        rv = _build_py.build_module(self, module, tmp_file, package)
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   653
                        os.unlink(tmp_file)
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   654
                        return rv
422
c69607a5bdce 2554 make install could stand to be quieter
Danek Duvall <danek.duvall@sun.com>
parents: 413
diff changeset
   655
849
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   656
                # Will raise a DistutilsError on failure.
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   657
                syntax_check(module_file)
5fd94ce78823 3813 pkg build needs to fail when sub-builds fail
Dan Price <dp@eng.sun.com>
parents: 836
diff changeset
   658
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   659
                return _build_py.build_module(self, module, module_file, package)
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   660
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   661
class clean_func(_clean):
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   662
        def initialize_options(self):
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   663
                _clean.initialize_options(self)
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   664
                self.build_base = build_dir
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   665
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   666
class clobber_func(Command):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   667
        user_options = []
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   668
        description = "Deletes any and all files created by setup"
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   669
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   670
        def initialize_options(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   671
                pass
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   672
        def finalize_options(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   673
                pass
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   674
        def run(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   675
                # nuke everything
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   676
                print("deleting " + dist_dir)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   677
                shutil.rmtree(dist_dir, True)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   678
                print("deleting " + build_dir)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   679
                shutil.rmtree(build_dir, True)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   680
                print("deleting " + root_dir)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   681
                shutil.rmtree(root_dir, True)
534
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   682
                print("deleting " + pkgs_dir)
44a901d55161 676 'make install' fails if GNU install is first in path
Dan Price <dp@eng.sun.com>
parents: 513
diff changeset
   683
                shutil.rmtree(pkgs_dir, True)
1099
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   684
                print("deleting " + extern_dir)
bd94d4910b8a 8602 tidy top level of source directory
Dan Price <dp@eng.sun.com>
parents: 1024
diff changeset
   685
                shutil.rmtree(extern_dir, True)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   686
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   687
class test_func(Command):
1101
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   688
        # NOTE: these options need to be in sync with tests/run.py and the
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   689
        # list of options stored in initialize_options below. The first entry
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   690
        # in each tuple must be the exact name of a member variable.
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   691
        user_options = [("verbosemode", 'v', "run tests in verbose mode"),
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   692
            ("genbaseline", 'g', "generate test baseline"),
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   693
            ("parseable", 'p', "parseable output"),
1101
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   694
            ("timing", "t", "timing file <file>"),
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   695
            ("baselinefile=", 'b', "baseline file <file>"),
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   696
            ("only=", "o", "only <regex>")]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   697
        description = "Runs unit and functional tests"
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   698
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   699
        def initialize_options(self):
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   700
                self.only = ""
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   701
                self.baselinefile = ""
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   702
                self.verbosemode = 0
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   703
                self.parseable = 0
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   704
                self.genbaseline = 0
1101
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   705
                self.timing = 0
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   706
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   707
        def finalize_options(self):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   708
                pass
1101
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   709
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   710
        def run(self):
1101
35f360e2ee19 5247 Test suite should provide timing info
Brock Pytlik <bpytlik@sun.com>
parents: 1099
diff changeset
   711
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   712
                os.putenv('PYEXE', sys.executable)
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   713
                os.chdir(os.path.join(pwd, "tests"))
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   714
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   715
                # Reconstruct the cmdline and send that to run.py
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   716
                cmd = [sys.executable, "run.py"]
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   717
                args = ""
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   718
                if "test" in sys.argv:
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   719
                        args = sys.argv[sys.argv.index("test")+1:]
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   720
                        cmd.extend(args)
448
bcfa99ac18b0 2664 test suite baseline enhancements
Brad Hall <bhall@eng.sun.com>
parents: 430
diff changeset
   721
                subprocess.call(cmd)
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   722
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   723
class dist_func(_bdist):
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   724
        def initialize_options(self):
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   725
                _bdist.initialize_options(self)
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   726
                self.dist_dir = dist_dir
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   727
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   728
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   729
# These are set to real values based on the platform, down below
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   730
compile_args = None
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   731
link_args = None
613
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   732
ext_modules = [
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   733
        Extension(
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   734
                'actions._actions',
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   735
                _actions_srcs,
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   736
                include_dirs = include_dirs,
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   737
                extra_compile_args = compile_args,
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   738
                extra_link_args = link_args
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   739
                ),
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   740
        ]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   741
elf_libraries = None
742
909b912fa942 3011 new depot index page desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents: 708
diff changeset
   742
data_files = web_files
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   743
cmdclasses = {
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   744
        'install': install_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   745
        'build': build_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   746
        'build_py': build_py_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   747
        'bdist': dist_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   748
        'lint': lint_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   749
        'clean': clean_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   750
        'clobber': clobber_func,
708
ef2162b85fab 4970 Add code coverage support
Brad Hall <bhall@eng.sun.com>
parents: 691
diff changeset
   751
        'coverage': cov_func,
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   752
        'test': test_func,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   753
        }
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   754
383
08762e4dac3c 1068 cleanup pylint errors caused by portable package
Tom Mueller <Tom.Mueller@sun.com>
parents: 365
diff changeset
   755
# all builds of IPS should have manpages
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   756
data_files += [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   757
        (man1_dir, man1_files),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   758
        (man1m_dir, man1m_files),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   759
        (man5_dir, man5_files),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   760
        ]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   761
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   762
if osname == 'sunos':
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   763
        # Solaris-specific extensions are added here
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   764
        data_files += [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   765
                (zones_dir, zones_files),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   766
                (brand_dir, brand_files),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   767
                (smf_dir, smf_files),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   768
                ]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   769
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   770
if osname == 'sunos' or osname == "linux":
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   771
        # Unix platforms which the elf extension has been ported to
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   772
        # are specified here, so they are built automatically
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   773
        elf_libraries = ['elf']
613
886277645061 3956 Windows API test cases fail
Tom Mueller <Tom.Mueller@sun.com>
parents: 591
diff changeset
   774
        ext_modules += [
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   775
                Extension(
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   776
                        'elf',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   777
                        elf_srcs,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   778
                        include_dirs = include_dirs,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   779
                        libraries = elf_libraries,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   780
                        extra_compile_args = compile_args,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   781
                        extra_link_args = link_args
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   782
                        ),
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   783
                ]
290
6c5c87515614 160 Make IPS cross-platform for use across other supported OS's (missing files)
Tom Mueller <Tom.Mueller@Sun.COM>
parents:
diff changeset
   784
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   785
        # Solaris has built-in md library and Solaris-specific arch extension
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   786
        # All others use OpenSSL and cross-platform arch module
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   787
        if osname == 'sunos':
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   788
            elf_libraries += [ 'md' ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   789
            ext_modules += [
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   790
                    Extension(
430
3fb945d3bff3 2627 Test suite should have support for baselining
Brad Hall <bhall@eng.sun.com>
parents: 424
diff changeset
   791
                            'arch',
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   792
                            arch_srcs,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   793
                            include_dirs = include_dirs,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   794
                            extra_compile_args = compile_args,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   795
                            extra_link_args = link_args,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   796
                            define_macros = [('_FILE_OFFSET_BITS', '64')]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   797
                            ),
691
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   798
                    Extension(
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   799
                            'pspawn',
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   800
                            pspawn_srcs,
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   801
                            include_dirs = include_dirs,
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   802
                            extra_compile_args = compile_args,
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   803
                            extra_link_args = link_args,
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   804
                            define_macros = [('_FILE_OFFSET_BITS', '64')]
cd1d9c1e82f3 4612 Alternative to os.fork needed for subprocess
johansen <johansen@sun.com>
parents: 661
diff changeset
   805
                            ),
395
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   806
                    ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   807
        else:
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   808
            elf_libraries += [ 'ssl' ]
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   809
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   810
setup(cmdclass = cmdclasses,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   811
    name = 'ips',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   812
    version = '1.0',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   813
    package_dir = {'pkg':'modules'},
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   814
    packages = packages,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   815
    data_files = data_files,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   816
    ext_package = 'pkg',
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   817
    ext_modules = ext_modules,
0ae5e72ba7ee 1958 Modify setup.py to handle pkgrecv
Tom Mueller <Tom.Mueller@sun.com>
parents: 384
diff changeset
   818
    )