setup.py revision 2535
1516N/A#!/usr/bin/python2.6
290N/A#
290N/A# CDDL HEADER START
290N/A#
290N/A# The contents of this file are subject to the terms of the
290N/A# Common Development and Distribution License (the "License").
290N/A# You may not use this file except in compliance with the License.
290N/A#
290N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
290N/A# or http://www.opensolaris.org/os/licensing.
290N/A# See the License for the specific language governing permissions
290N/A# and limitations under the License.
290N/A#
290N/A# When distributing Covered Code, include this CDDL HEADER in each
290N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
290N/A# If applicable, add the following below this CDDL HEADER, with the
290N/A# fields enclosed by brackets "[]" replaced with your own identifying
290N/A# information: Portions Copyright [yyyy] [name of copyright owner]
290N/A#
290N/A# CDDL HEADER END
290N/A#
2223N/A# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
395N/A#
290N/A
883N/Aimport errno
454N/Aimport fnmatch
290N/Aimport os
448N/Aimport platform
290N/Aimport stat
290N/Aimport sys
290N/Aimport shutil
383N/Aimport re
290N/Aimport subprocess
395N/Aimport tarfile
290N/Aimport tempfile
395N/Aimport urllib
849N/Aimport py_compile
1516N/Aimport hashlib
290N/Aimport time
849N/A
290N/Afrom distutils.errors import DistutilsError, DistutilsFileError
290N/Afrom distutils.core import setup, Extension
290N/Afrom distutils.cmd import Command
290N/Afrom distutils.command.install import install as _install
383N/Afrom distutils.command.install_data import install_data as _install_data
290N/Afrom distutils.command.build import build as _build
290N/Afrom distutils.command.build_ext import build_ext as _build_ext
290N/Afrom distutils.command.build_py import build_py as _build_py
290N/Afrom distutils.command.bdist import bdist as _bdist
290N/Afrom distutils.command.clean import clean as _clean
290N/Afrom distutils.dist import Distribution
290N/Afrom distutils import log
290N/A
1660N/Afrom distutils.sysconfig import get_python_inc
1660N/Aimport distutils.dep_util as dep_util
1660N/Aimport distutils.dir_util as dir_util
1660N/Aimport distutils.file_util as file_util
1660N/Aimport distutils.util as util
1660N/Aimport distutils.ccompiler
1660N/Afrom distutils.unixccompiler import UnixCCompiler
1660N/A
1660N/Aosname = platform.uname()[0].lower()
1660N/Aostype = arch = 'unknown'
1660N/Aif osname == 'sunos':
1660N/A arch = platform.processor()
1660N/A ostype = "posix"
1660N/Aelif osname == 'linux':
1660N/A arch = "linux_" + platform.machine()
1660N/A ostype = "posix"
1660N/Aelif osname == 'windows':
1660N/A arch = osname
465N/A ostype = "windows"
465N/Aelif osname == 'darwin':
465N/A arch = osname
1516N/A ostype = "posix"
465N/Aelif osname == 'aix':
465N/A arch = "aix"
465N/A ostype = "posix"
1516N/A
465N/Apwd = os.path.normpath(sys.path[0])
465N/A
465N/A#
465N/A# Unbuffer stdout and stderr. This helps to ensure that subprocess output
465N/A# is properly interleaved with output from this program.
465N/A#
465N/Asys.stdout = os.fdopen(sys.stdout.fileno(), "w", 0)
1099N/Asys.stderr = os.fdopen(sys.stderr.fileno(), "w", 0)
465N/A
1513N/Adist_dir = os.path.normpath(os.path.join(pwd, os.pardir, "proto", "dist_" + arch))
1513N/Abuild_dir = os.path.normpath(os.path.join(pwd, os.pardir, "proto", "build_" + arch))
2075N/Aif "ROOT" in os.environ and os.environ["ROOT"] != "":
2180N/A root_dir = os.environ["ROOT"]
2075N/Aelse:
2075N/A root_dir = os.path.normpath(os.path.join(pwd, os.pardir, "proto", "root_" + arch))
2075N/Apkgs_dir = os.path.normpath(os.path.join(pwd, os.pardir, "packages", arch))
2075N/Aextern_dir = os.path.normpath(os.path.join(pwd, "extern"))
708N/A
1391N/Apy_install_dir = 'usr/lib/python2.6/vendor-packages'
1391N/A
1391N/Ascripts_dir = 'usr/bin'
1391N/Alib_dir = 'usr/lib'
1391N/Asvc_method_dir = 'lib/svc/method'
1391N/A
1391N/Aman1_dir = 'usr/share/man/man1'
1391N/Aman1m_dir = 'usr/share/man/man1m'
1391N/Aman5_dir = 'usr/share/man/man5'
1391N/Aman1_ja_JP_dir = 'usr/share/man/ja_JP.UTF-8/man1'
1391N/Aman1m_ja_JP_dir = 'usr/share/man/ja_JP.UTF-8/man1m'
742N/Aman5_ja_JP_dir = 'usr/share/man/ja_JP.UTF-8/man5'
742N/Aman1_zh_CN_dir = 'usr/share/man/zh_CN.UTF-8/man1'
742N/Aman1m_zh_CN_dir = 'usr/share/man/zh_CN.UTF-8/man1m'
742N/Aman5_zh_CN_dir = 'usr/share/man/zh_CN.UTF-8/man5'
742N/A
742N/Aresource_dir = 'usr/share/lib/pkg'
1099N/Atransform_dir = 'usr/share/pkg/transforms'
742N/Asmf_app_dir = 'lib/svc/manifest/application/pkg'
941N/Aexecattrd_dir = 'etc/security/exec_attr.d'
941N/Aauthattrd_dir = 'etc/security/auth_attr.d'
941N/Asysrepo_dir = 'etc/pkg/sysrepo'
941N/Asysrepo_logs_dir = 'var/log/pkg/sysrepo'
941N/Asysrepo_cache_dir = 'var/cache/pkg/sysrepo'
941N/Aautostart_dir = 'etc/xdg/autostart'
1099N/Adesktop_dir = 'usr/share/applications'
941N/Agconf_dir = 'etc/gconf/schemas'
2023N/Ahelp_dir = 'usr/share/gnome/help/package-manager'
2023N/Aomf_dir = 'usr/share/omf/package-manager'
2023N/Astartpage_dir = 'usr/share/package-manager/data/startpagebase'
2023N/Aum_lib_dir = 'usr/lib/update-manager'
2023N/Aum_share_dir = 'usr/share/update-manager'
2023N/Apm_share_dir = 'usr/share/package-manager'
2023N/Alocale_dir = 'usr/share/locale'
2023N/A
1191N/A
1513N/A# A list of source, destination tuples of modules which should be hardlinked
1191N/A# together if the os supports it and otherwise copied.
2180N/Ahardlink_modules = []
1191N/A
1191N/Ascripts_sunos = {
1191N/A scripts_dir: [
1191N/A ['client.py', 'pkg'],
1660N/A ['pkgdep.py', 'pkgdepend'],
1660N/A ['pkgrepo.py', 'pkgrepo'],
1660N/A ['util/publish/pkgdiff.py', 'pkgdiff'],
290N/A ['util/publish/pkgfmt.py', 'pkgfmt'],
2026N/A ['util/publish/pkglint.py', 'pkglint'],
2026N/A ['util/publish/pkgmerge.py', 'pkgmerge'],
2026N/A ['util/publish/pkgmogrify.py', 'pkgmogrify'],
2026N/A ['publish.py', 'pkgsend'],
2026N/A ['pull.py', 'pkgrecv'],
2026N/A ['sign.py', 'pkgsign'],
2026N/A ['packagemanager.py', 'packagemanager'],
2026N/A ['updatemanager.py', 'pm-updatemanager'],
448N/A ],
448N/A lib_dir: [
534N/A ['depot.py', 'pkg.depotd'],
534N/A ['checkforupdates.py', 'pm-checkforupdates'],
534N/A ['updatemanagernotifier.py', 'updatemanagernotifier'],
534N/A ['launch.py', 'pm-launch'],
534N/A ['sysrepo.py', 'pkg.sysrepo'],
534N/A ],
534N/A um_lib_dir: [
290N/A ['um/update-refresh.sh', 'update-refresh.sh'],
290N/A ],
954N/A svc_method_dir: [
954N/A ['svc/svc-pkg-depot', 'svc-pkg-depot'],
954N/A ['svc/svc-pkg-mdns', 'svc-pkg-mdns'],
954N/A ['svc/svc-pkg-sysrepo', 'svc-pkg-sysrepo'],
534N/A ['um/pkg-update', 'pkg-update'],
1099N/A ],
290N/A }
1516N/A
290N/Ascripts_windows = {
290N/A scripts_dir: [
290N/A ['client.py', 'client.py'],
661N/A ['pkgrepo.py', 'pkgrepo.py'],
290N/A ['publish.py', 'publish.py'],
290N/A ['pull.py', 'pull.py'],
290N/A ['scripts/pkg.bat', 'pkg.bat'],
395N/A ['scripts/pkgsend.bat', 'pkgsend.bat'],
290N/A ['scripts/pkgrecv.bat', 'pkgrecv.bat'],
2125N/A ],
290N/A lib_dir: [
1483N/A ['depot.py', 'depot.py'],
290N/A ['scripts/pkg.depotd.bat', 'pkg.depotd.bat'],
1498N/A ],
1498N/A }
290N/A
1674N/Ascripts_other_unix = {
1674N/A scripts_dir: [
1674N/A ['client.py', 'client.py'],
1674N/A ['pkgdep.py', 'pkgdep'],
1674N/A ['util/publish/pkgdiff.py', 'pkgdiff'],
1674N/A ['util/publish/pkgfmt.py', 'pkgfmt'],
1674N/A ['util/publish/pkgmogrify.py', 'pkgmogrify'],
395N/A ['pull.py', 'pull.py'],
430N/A ['publish.py', 'publish.py'],
395N/A ['scripts/pkg.sh', 'pkg'],
1544N/A ['scripts/pkgsend.sh', 'pkgsend'],
1968N/A ['scripts/pkgrecv.sh', 'pkgrecv'],
1557N/A ],
1903N/A lib_dir: [
2046N/A ['depot.py', 'depot.py'],
2240N/A ['scripts/pkg.depotd.sh', 'pkg.depotd'],
1506N/A ],
395N/A }
395N/A
2026N/A# indexed by 'osname'
424N/Ascripts = {
1024N/A "sunos": scripts_sunos,
395N/A "linux": scripts_other_unix,
395N/A "windows": scripts_windows,
395N/A "darwin": scripts_other_unix,
2078N/A "aix" : scripts_other_unix,
578N/A "unknown": scripts_sunos,
1172N/A }
395N/A
661N/Aman1_files = [
1099N/A 'man/packagemanager.1',
1902N/A 'man/pkg.1',
661N/A 'man/pkgdepend.1',
395N/A 'man/pkgdiff.1',
849N/A 'man/pkgfmt.1',
290N/A 'man/pkglint.1',
395N/A 'man/pkgmerge.1',
395N/A 'man/pkgmogrify.1',
1968N/A 'man/pkgsend.1',
395N/A 'man/pkgsign.1',
395N/A 'man/pkgrecv.1',
395N/A 'man/pkgrepo.1',
395N/A 'man/pm-updatemanager.1',
395N/A ]
395N/Aman1m_files = [
395N/A 'man/pkg.depotd.1m',
395N/A 'man/pkg.sysrepo.1m'
395N/A ]
395N/Aman5_files = [
395N/A 'man/pkg.5'
290N/A ]
290N/A
395N/Aman1_ja_files = [
395N/A 'man/ja_JP/packagemanager.1',
1231N/A 'man/ja_JP/pkg.1',
1557N/A 'man/ja_JP/pkgdepend.1',
1903N/A 'man/ja_JP/pkgdiff.1',
1557N/A 'man/ja_JP/pkgfmt.1',
395N/A 'man/ja_JP/pkglint.1',
395N/A 'man/ja_JP/pkgmerge.1',
395N/A 'man/ja_JP/pkgmogrify.1',
395N/A 'man/ja_JP/pkgsend.1',
395N/A 'man/ja_JP/pkgsign.1',
395N/A 'man/ja_JP/pkgrecv.1',
395N/A 'man/ja_JP/pkgrepo.1',
395N/A 'man/ja_JP/pm-updatemanager.1',
395N/A ]
395N/Aman1m_ja_files = [
395N/A 'man/ja_JP/pkg.depotd.1m',
290N/A 'man/ja_JP/pkg.sysrepo.1m'
290N/A ]
430N/Aman5_ja_files = [
395N/A 'man/ja_JP/pkg.5'
395N/A ]
395N/A
395N/Aman1_zh_CN_files = [
1302N/A 'man/zh_CN/packagemanager.1',
395N/A 'man/zh_CN/pkg.1',
395N/A 'man/zh_CN/pkgdepend.1',
290N/A 'man/zh_CN/pkgdiff.1',
395N/A 'man/zh_CN/pkgfmt.1',
1024N/A 'man/zh_CN/pkglint.1',
413N/A 'man/zh_CN/pkgmerge.1',
1544N/A 'man/zh_CN/pkgmogrify.1',
1557N/A 'man/zh_CN/pkgsend.1',
1903N/A 'man/zh_CN/pkgsign.1',
2046N/A 'man/zh_CN/pkgrecv.1',
2240N/A 'man/zh_CN/pkgrepo.1',
1506N/A 'man/zh_CN/pm-updatemanager.1',
413N/A ]
2026N/Aman1m_zh_CN_files = [
413N/A 'man/zh_CN/pkg.depotd.1m',
1978N/A 'man/zh_CN/pkg.sysrepo.1m'
1024N/A ]
395N/Aman5_zh_CN_files = [
395N/A 'man/zh_CN/pkg.5'
413N/A ]
395N/A
395N/Apackages = [
413N/A 'pkg',
395N/A 'pkg.actions',
395N/A 'pkg.bundle',
395N/A 'pkg.client',
395N/A 'pkg.client.linkedimage',
395N/A 'pkg.client.transport',
395N/A 'pkg.file_layout',
1191N/A 'pkg.flavor',
1452N/A 'pkg.gui',
1231N/A 'pkg.lint',
2046N/A 'pkg.portable',
395N/A 'pkg.publish',
395N/A 'pkg.server'
424N/A ]
395N/A
742N/Apylint_targets = [
742N/A 'pkg.altroot',
742N/A 'pkg.client.linkedimage',
742N/A 'pkg.client.pkgdefs',
742N/A ]
742N/A
742N/Aweb_files = []
742N/Afor entry in os.walk("web"):
742N/A web_dir, dirs, files = entry
742N/A if not files:
742N/A continue
395N/A web_files.append((os.path.join(resource_dir, web_dir), [
395N/A os.path.join(web_dir, f) for f in files
395N/A if f != "Makefile"
395N/A ]))
395N/A
954N/Asmf_app_files = [
954N/A 'svc/pkg-mdns.xml',
954N/A 'svc/pkg-server.xml',
954N/A 'svc/pkg-update.xml',
954N/A 'svc/pkg-system-repository.xml',
954N/A 'svc/zoneproxy-client.xml',
954N/A 'svc/zoneproxyd.xml'
395N/A ]
1483N/Aresource_files = [
1483N/A 'util/opensolaris.org.sections',
1483N/A 'util/pkglintrc',
1483N/A ]
395N/Atransform_files = [
1902N/A 'util/publish/transforms/developer',
1099N/A 'util/publish/transforms/documentation',
1099N/A 'util/publish/transforms/locale',
395N/A 'util/publish/transforms/smf-manifests'
2046N/A ]
2223N/Asysrepo_files = [
2046N/A 'util/apache2/sysrepo/sysrepo_httpd.conf.mako',
2046N/A 'util/apache2/sysrepo/sysrepo_publisher_response.mako',
1498N/A ]
1498N/Asysrepo_log_stubs = [
691N/A 'util/apache2/sysrepo/logs/access_log',
691N/A 'util/apache2/sysrepo/logs/error_log',
691N/A ]
395N/Aexecattrd_files = [
395N/A 'util/misc/exec_attr.d/package:pkg',
395N/A 'util/misc/exec_attr.d/package:pkg:package-manager'
395N/A]
395N/Aauthattrd_files = ['util/misc/auth_attr.d/package:pkg']
290N/Aautostart_files = [
395N/A 'um/data/updatemanagernotifier.desktop',
395N/A]
591N/Adesktop_files = [
591N/A 'gui/data/addmoresoftware.desktop',
591N/A 'gui/data/packagemanager.desktop',
1505N/A 'um/data/updatemanager.desktop',
1505N/A]
1505N/Agconf_files = [
1505N/A 'gui/data/packagemanager-preferences.schemas',
1632N/A 'um/data/updatemanager-preferences.schemas',
1632N/A]
1632N/Aintl_files = [
1632N/A 'gui/data/addmoresoftware.desktop.in',
395N/A 'gui/data/packagemanager-info.xml.in',
395N/A 'gui/data/packagemanager-preferences.schemas.in',
290N/A 'gui/data/packagemanager.desktop.in',
290N/A 'um/data/updatemanager-preferences.schemas.in',
290N/A 'um/data/updatemanager.desktop.in',
290N/A 'um/data/updatemanagernotifier.desktop.in',
290N/A]
290N/Ahelp_locales = \
290N/A 'C ar ca cs de es fr hu id it ja ko pl pt_BR ru sv zh_CN zh_HK zh_TW'.split()
290N/Ahelp_files = {
290N/A 'C': ['gui/help/C/package-manager.xml'],
290N/A 'C/figures': [
290N/A 'gui/help/C/figures/%s.png' % n
290N/A for n in 'pkgmgr-main startpage_new update_all_new webinstall'.split()
290N/A ]
290N/A}
395N/Ahelp_files.update(
395N/A (locale, ['gui/help/%s/package-manager.xml' % locale])
290N/A for locale in help_locales[1:]
290N/A)
290N/Aomf_files = [
290N/A 'gui/help/package-manager-%s.omf' % locale
290N/A for locale in help_locales
395N/A]
395N/Astartpage_locales = \
395N/A 'C ar ca cs de es fr hu id it ja ko nl pt_BR ru sv zh_CN zh_HK zh_TW'.split()
290N/Astartpage_files = {
395N/A 'C': [
395N/A 'gui/data/startpagebase/C/%s.png' % n
395N/A for n in [
395N/A 'dialog-information', 'dialog-warning', 'hc_dialog-information',
591N/A 'hc_dialog-warning', 'hc_install', 'hc_opensolaris',
591N/A 'hci_dialog-information', 'hci_dialog-warning', 'hci_install',
591N/A 'hci_opensolaris', 'install', 'opensolaris'
591N/A ]
691N/A ] + ['gui/data/startpagebase/C/startpage.html']
691N/A}
691N/Astartpage_files.update(
691N/A (locale, ['gui/data/startpagebase/%s/startpage.html' % locale])
290N/A for locale in startpage_locales[1:]
290N/A)
290N/Apkg_locales = \
290N/A 'ar ca cs de es fr he hu id it ja ko nl pl pt_BR ru sk sv zh_CN zh_HK zh_TW'.split()
290N/A
591N/Asyscallat_srcs = [
591N/A 'modules/syscallat.c'
691N/A ]
691N/Apspawn_srcs = [
290N/A 'modules/pspawn.c'
395N/A ]
395N/Aelf_srcs = [
290N/A 'modules/elf.c',
395N/A 'modules/elfextract.c',
395N/A 'modules/liblist.c',
395N/A ]
395N/Aarch_srcs = [
290N/A 'modules/arch.c'
290N/A ]
290N/A_actions_srcs = [
395N/A 'modules/actions/_actions.c'
395N/A ]
395N/Asolver_srcs = [
395N/A 'modules/solver/solver.c',
395N/A 'modules/solver/py_solver.c'
395N/A ]
290N/Asolver_link_args = ["-lm", "-lc"]
290N/Aif osname == 'sunos':
290N/A solver_link_args = ["-ztext"] + solver_link_args
290N/A
290N/A# Runs lint on the extension module source code
430N/Aclass pylint_func(Command):
290N/A description = "Runs pylint tools over IPS python source code"
290N/A user_options = []
395N/A
290N/A def initialize_options(self):
395N/A pass
506N/A
506N/A def finalize_options(self):
506N/A pass
506N/A
506N/A # Make string shell-friendly
506N/A @staticmethod
506N/A def escape(astring):
506N/A return astring.replace(' ', '\\ ')
834N/A
506N/A def run(self, quiet=False):
506N/A proto = os.path.join(root_dir, py_install_dir)
506N/A sys.path.insert(0, proto)
513N/A
506N/A # Insert tests directory onto sys.path so any custom checkers
506N/A # can be found.
506N/A sys.path.insert(0, os.path.join(pwd, 'tests'))
506N/A # assumes pylint is accessible on the sys.path
290N/A from pylint import lint
290N/A
395N/A #
395N/A # For some reason, the load-plugins option, when used in the
849N/A # rcfile, does not work, so we put it here instead, to load
849N/A # our custom checkers.
883N/A #
883N/A # Unfortunately, pylint seems pretty fragile and will crash if
395N/A # we try to run it over all the current pkg source. Hence for
413N/A # now we only run it over a subset of the source. As source
413N/A # files are made pylint clean they should be added to the
413N/A # pylint_targets list.
395N/A #
290N/A args = ['--load-plugins=multiplatform']
1674N/A if quiet:
1674N/A args += ['--reports=no']
1674N/A args += ['--rcfile', os.path.join(pwd, 'tests', 'pylintrc')]
1674N/A args += pylint_targets
1674N/A lint.Run(args)
1674N/A
1674N/A
1674N/Aclass pylint_func_quiet(pylint_func):
1674N/A
1674N/A def run(self, quiet=False):
1674N/A pylint_func.run(self, quiet=True)
1674N/A
1674N/A
1674N/Ainclude_dirs = [ 'modules' ]
1674N/Alint_flags = [ '-u', '-axms', '-erroff=E_NAME_DEF_NOT_USED2' ]
395N/A
395N/A# Runs lint on the extension module source code
506N/Aclass clint_func(Command):
506N/A description = "Runs lint tools over IPS C extension source code"
395N/A user_options = []
395N/A
395N/A def initialize_options(self):
395N/A pass
430N/A
849N/A def finalize_options(self):
834N/A pass
290N/A
1391N/A # Make string shell-friendly
1391N/A @staticmethod
1401N/A def escape(astring):
1391N/A return astring.replace(' ', '\\ ')
1391N/A
1391N/A def run(self):
1391N/A # assumes lint is on the $PATH
1391N/A if osname == 'sunos' or osname == "linux":
1391N/A archcmd = ['lint'] + lint_flags + ['-D_FILE_OFFSET_BITS=64'] + \
1391N/A ["%s%s" % ("-I", k) for k in include_dirs] + \
1391N/A ['-I' + self.escape(get_python_inc())] + \
836N/A arch_srcs
836N/A elfcmd = ['lint'] + lint_flags + \
849N/A ["%s%s" % ("-I", k) for k in include_dirs] + \
849N/A ['-I' + self.escape(get_python_inc())] + \
849N/A ["%s%s" % ("-l", k) for k in elf_libraries] + \
849N/A elf_srcs
849N/A _actionscmd = ['lint'] + lint_flags + \
849N/A ["%s%s" % ("-I", k) for k in include_dirs] + \
849N/A ['-I' + self.escape(get_python_inc())] + \
849N/A _actions_srcs
849N/A pspawncmd = ['lint'] + lint_flags + ['-D_FILE_OFFSET_BITS=64'] + \
849N/A ["%s%s" % ("-I", k) for k in include_dirs] + \
849N/A ['-I' + self.escape(get_python_inc())] + \
849N/A pspawn_srcs
1513N/A syscallatcmd = ['lint'] + lint_flags + ['-D_FILE_OFFSET_BITS=64'] + \
1391N/A ["%s%s" % ("-I", k) for k in include_dirs] + \
849N/A ['-I' + self.escape(get_python_inc())] + \
2026N/A syscallat_srcs
2026N/A
1513N/A print(" ".join(archcmd))
1391N/A os.system(" ".join(archcmd))
1513N/A print(" ".join(elfcmd))
1391N/A os.system(" ".join(elfcmd))
1391N/A print(" ".join(_actionscmd))
1660N/A os.system(" ".join(_actionscmd))
1513N/A print(" ".join(pspawncmd))
1513N/A os.system(" ".join(pspawncmd))
2023N/A print(" ".join(syscallatcmd))
2023N/A os.system(" ".join(syscallatcmd))
290N/A
883N/A
883N/A# Runs both C and Python lint
883N/Aclass lint_func(Command):
883N/A description = "Runs C and Python lint checkers"
883N/A user_options = []
883N/A
883N/A def initialize_options(self):
883N/A pass
883N/A
883N/A def finalize_options(self):
883N/A pass
883N/A
883N/A # Make string shell-friendly
883N/A @staticmethod
883N/A def escape(astring):
883N/A return astring.replace(' ', '\\ ')
1099N/A
1099N/A def run(self):
1099N/A clint_func(Distribution()).run()
1099N/A pylint_func(Distribution()).run()
1099N/A
1516N/Aclass install_func(_install):
1265N/A def initialize_options(self):
1099N/A _install.initialize_options(self)
1099N/A
1099N/A # PRIVATE_BUILD set in the environment tells us to put the build
1099N/A # directory into the .pyc files, rather than the final
1099N/A # installation directory.
1099N/A private_build = os.getenv("PRIVATE_BUILD", None)
1099N/A
1099N/A if private_build is None:
1099N/A self.install_lib = py_install_dir
1099N/A self.install_data = os.path.sep
1208N/A self.root = root_dir
1208N/A else:
1099N/A self.install_lib = os.path.join(root_dir, py_install_dir)
1099N/A self.install_data = root_dir
1391N/A
1099N/A # This is used when installing scripts, below, but it isn't a
1099N/A # standard distutils variable.
1099N/A self.root_dir = root_dir
1099N/A
1099N/A def run(self):
465N/A """At the end of the install function, we need to rename some
465N/A files because distutils provides no way to rename files as they
395N/A are placed in their install locations.
465N/A """
395N/A
395N/A _install.run(self)
2176N/A
1208N/A for o_src, o_dest in hardlink_modules:
1208N/A for e in [".py", ".pyc"]:
465N/A src = util.change_root(self.root_dir, o_src + e)
395N/A dest = util.change_root(
465N/A self.root_dir, o_dest + e)
395N/A if ostype == "posix":
465N/A if os.path.exists(dest) and \
1099N/A os.stat(src)[stat.ST_INO] != \
1099N/A os.stat(dest)[stat.ST_INO]:
1099N/A os.remove(dest)
465N/A file_util.copy_file(src, dest,
465N/A link="hard", update=1)
395N/A else:
395N/A file_util.copy_file(src, dest, update=1)
1099N/A
395N/A for d, files in scripts[osname].iteritems():
1191N/A for (srcname, dstname) in files:
1191N/A dst_dir = util.change_root(self.root_dir, d)
1191N/A dst_path = util.change_root(self.root_dir,
1191N/A os.path.join(d, dstname))
1191N/A dir_util.mkpath(dst_dir, verbose=True)
1191N/A file_util.copy_file(srcname, dst_path, update=True)
1191N/A # make scripts executable
1191N/A os.chmod(dst_path,
1191N/A os.stat(dst_path).st_mode
1191N/A | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
1265N/A
1265N/Aclass install_data_func(_install_data):
1265N/A """Enhance the standard install_data subcommand to take not only a list
1208N/A of filenames, but a list of source and destination filename tuples, for
1208N/A the cases where a filename needs to be renamed between the two
1208N/A locations."""
1208N/A
1208N/A def run(self):
1208N/A self.mkpath(self.install_dir)
1208N/A for f in self.data_files:
1191N/A dir, files = f
1191N/A dir = util.convert_path(dir)
1391N/A if not os.path.isabs(dir):
1391N/A dir = os.path.join(self.install_dir, dir)
1391N/A elif self.root:
1391N/A dir = change_root(self.root, dir)
1391N/A self.mkpath(dir)
1391N/A
1391N/A if not files:
1394N/A self.outfiles.append(dir)
1394N/A else:
1391N/A for file in files:
1391N/A if isinstance(file, basestring):
1391N/A infile = file
1391N/A outfile = os.path.join(dir,
1391N/A os.path.basename(file))
1391N/A else:
1391N/A infile, outfile = file
1660N/A infile = util.convert_path(infile)
1391N/A outfile = util.convert_path(outfile)
465N/A if os.path.sep not in outfile:
1660N/A outfile = os.path.join(dir,
1660N/A outfile)
1660N/A self.copy_file(infile, outfile)
1660N/A self.outfiles.append(outfile)
465N/A
465N/A # Don't bother making this generic for the one symlink.
1516N/A src = "HighContrastInverse"
498N/A dst = os.path.join(self.install_dir, pm_share_dir,
498N/A "icons/HighContrastLargePrintInverse")
849N/A try:
1660N/A targ = os.readlink(dst)
1391N/A except OSError, e:
1660N/A if e.errno in (errno.ENOENT, errno.EINVAL):
1660N/A targ = None
1660N/A else:
1660N/A raise
849N/A
1208N/A if src != targ:
1208N/A log.info("linking %s -> %s" % (src, dst))
1208N/A rm_f(dst)
1208N/A os.symlink(src, dst)
849N/A
290N/Adef run_cmd(args, swdir, env=None):
465N/A if env is None:
465N/A env = os.environ
1099N/A ret = subprocess.Popen(args, cwd=swdir, env=env).wait()
465N/A if ret != 0:
1099N/A print >> sys.stderr, \
1099N/A "install failed and returned %d." % ret
1099N/A print >> sys.stderr, \
454N/A "Command was: %s" % " ".join(args)
1099N/A sys.exit(1)
849N/A
290N/Adef _copy_file_contents(src, dst, buffer_size=16*1024):
430N/A """A clone of distutils.file_util._copy_file_contents() that strips the
395N/A CDDL text."""
395N/A
290N/A # Match the lines between and including the CDDL header signposts, as
383N/A # well as empty comment lines before and after, if they exist.
383N/A cddl_re = re.compile("\n(#\s*\n)?^[^\n]*CDDL HEADER START.+"
395N/A "CDDL HEADER END[^\n]*$(\n#\s*$)?", re.MULTILINE|re.DOTALL)
383N/A
383N/A with file(src, "r") as sfp:
384N/A try:
383N/A os.unlink(dst)
849N/A except EnvironmentError, e:
849N/A if e.errno != errno.ENOENT:
849N/A raise DistutilsFileError("could not delete "
849N/A "'%s': %s" % (dst, e))
849N/A
849N/A with file(dst, "w") as dfp:
849N/A while True:
849N/A buf = sfp.read(buffer_size)
849N/A if not buf:
2242N/A break
2242N/A buf = cddl_re.sub("", buf)
2242N/A dfp.write(buf)
2242N/A
2242N/A# Make file_util use our version of _copy_file_contents
2242N/Afile_util._copy_file_contents = _copy_file_contents
2242N/A
2242N/Adef intltool_merge(src, dst):
2242N/A if not dep_util.newer(src, dst):
2242N/A return
2242N/A
2242N/A args = [
849N/A "/usr/bin/intltool-merge", "-d", "-u",
849N/A "-c", "po/.intltool-merge-cache", "po", src, dst
383N/A ]
383N/A print " ".join(args)
383N/A run_cmd(args, os.getcwd(), os.environ.copy().update({"LC_ALL": "C"}))
849N/A
383N/Adef msgfmt(src, dst):
422N/A if not dep_util.newer(src, dst):
422N/A return
422N/A
422N/A args = ["/usr/bin/msgfmt", "-o", dst, src]
422N/A print " ".join(args)
422N/A run_cmd(args, os.getcwd())
422N/A
422N/Adef xml2po(src, dst, mofile):
422N/A msgfmt(mofile[:-3] + ".po", mofile)
422N/A
422N/A monewer = dep_util.newer(mofile, dst)
422N/A srcnewer = dep_util.newer(src, dst)
422N/A
422N/A if not srcnewer and not monewer:
422N/A return
422N/A
422N/A args = ["/usr/bin/xml2po", "-t", mofile, "-o", dst, src]
383N/A print " ".join(args)
422N/A run_cmd(args, os.getcwd())
383N/A
383N/Aclass installfile(Command):
383N/A user_options = [
383N/A ("file=", "f", "source file to copy"),
383N/A ("dest=", "d", "destination directory"),
383N/A ("mode=", "m", "file mode"),
383N/A ]
422N/A
849N/A description = "De-CDDLing file copy"
849N/A
849N/A def initialize_options(self):
383N/A self.file = None
383N/A self.dest = None
290N/A self.mode = None
430N/A
395N/A def finalize_options(self):
395N/A if self.mode is None:
290N/A self.mode = 0644
290N/A elif isinstance(self.mode, basestring):
290N/A try:
290N/A self.mode = int(self.mode, 8)
290N/A except ValueError:
290N/A self.mode = 0644
290N/A
290N/A def run(self):
290N/A dest_file = os.path.join(self.dest, os.path.basename(self.file))
290N/A ret = self.copy_file(self.file, dest_file)
290N/A
395N/A os.chmod(dest_file, self.mode)
290N/A os.utime(dest_file, None)
395N/A
290N/A return ret
395N/A
290N/Aclass build_func(_build):
534N/A sub_commands = _build.sub_commands + [('build_data', None)]
534N/A
1099N/A def initialize_options(self):
1099N/A _build.initialize_options(self)
290N/A self.build_base = build_dir
290N/A
1101N/Adef get_hg_version():
1101N/A try:
1101N/A p = subprocess.Popen(['hg', 'id', '-i'], stdout = subprocess.PIPE)
1513N/A return p.communicate()[0].strip()
1715N/A except OSError:
1513N/A print >> sys.stderr, "ERROR: unable to obtain mercurial version"
1513N/A return "unknown"
448N/A
1513N/Adef syntax_check(filename):
448N/A """ Run python's compiler over the file, and discard the results.
1101N/A Arrange to generate an exception if the file does not compile.
1513N/A This is needed because distutil's own use of pycompile (in the
1715N/A distutils.utils module) is broken, and doesn't stop on error. """
1715N/A try:
1716N/A py_compile.compile(filename, os.devnull, doraise=True)
1715N/A except py_compile.PyCompileError, e:
1715N/A res = ""
1513N/A for err in e.exc_value:
290N/A if isinstance(err, basestring):
290N/A res += err + "\n"
290N/A continue
448N/A
448N/A # Assume it's a tuple of (filename, lineno, col, code)
430N/A fname, line, col, code = err
448N/A res += "line %d, column %s, in %s:\n%s" % (line,
430N/A col or "unknown", fname, code)
1101N/A
1513N/A raise DistutilsError(res)
1715N/A
1715N/A# On Solaris, ld inserts the full argument to the -o option into the symbol
1716N/A# table. This means that the resulting object will be different depending on
1715N/A# the path at which the workspace lives, and not just on the interesting content
1715N/A# of the object.
1101N/A#
290N/A# In order to work around that bug (7076871), we create a new compiler class
290N/A# that looks at the argument indicating the output file, chdirs to its
1101N/A# directory, and runs the real link with the output file set to just the base
290N/A# name of the file.
1101N/A#
290N/A# Unfortunately, distutils isn't too customizable in this regard, so we have to
290N/A# twiddle with a couple of the names in the distutils.ccompiler namespace: we
290N/A# have to add a new entry to the compiler_class dict, and we have to override
448N/A# the new_compiler() function to point to our own. Luckily, our copy of
448N/A# new_compiler() gets to be very simple, since we always know what we want to
448N/A# return.
448N/Aclass MyUnixCCompiler(UnixCCompiler):
448N/A
430N/A def link(self, *args, **kwargs):
448N/A
290N/A output_filename = args[2]
290N/A output_dir = kwargs.get('output_dir')
290N/A cwd = os.getcwd()
430N/A
395N/A assert(not output_dir)
290N/A output_dir = os.path.join(cwd, os.path.dirname(output_filename))
2180N/A output_filename = os.path.basename(output_filename)
2180N/A nargs = args[:2] + (output_filename,) + args[3:]
2180N/A os.chdir(output_dir)
2180N/A
2180N/A UnixCCompiler.link(self, *nargs, **kwargs)
2180N/A
2180N/A os.chdir(cwd)
2180N/A
2180N/Adistutils.ccompiler.compiler_class['myunix'] = (
2180N/A 'unixccompiler', 'MyUnixCCompiler',
2180N/A 'standard Unix-style compiler with a link stage modified for Solaris'
2180N/A)
2180N/A
2180N/Adef my_new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0):
2180N/A return MyUnixCCompiler(None, dry_run, force)
2180N/A
2180N/Aif osname == 'sunos':
2180N/A distutils.ccompiler.new_compiler = my_new_compiler
2180N/A
2180N/Aclass build_ext_func(_build_ext):
2180N/A
2180N/A def initialize_options(self):
2180N/A _build_ext.initialize_options(self)
2180N/A if osname == 'sunos':
2180N/A self.compiler = 'myunix'
2180N/A
2180N/Aclass build_py_func(_build_py):
2180N/A
290N/A def __init__(self, dist):
290N/A ret = _build_py.__init__(self, dist)
290N/A
1637N/A # Gather the timestamps of the .py files in the gate, so we can
1637N/A # force the mtimes of the built and delivered copies to be
290N/A # consistent across builds, causing their corresponding .pyc
613N/A # files to be unchanged unless the .py file content changed.
613N/A
613N/A self.timestamps = {}
613N/A
613N/A p = subprocess.Popen(
613N/A [sys.executable, os.path.join(pwd, "pydates")],
613N/A stdout=subprocess.PIPE)
613N/A
1632N/A for line in p.stdout:
1632N/A stamp, path = line.split()
1632N/A stamp = float(stamp)
1632N/A self.timestamps[path] = stamp
1632N/A
1632N/A if p.wait() != 0:
1632N/A print >> sys.stderr, "ERROR: unable to gather .py " \
1632N/A "timestamps"
613N/A sys.exit(1)
290N/A
742N/A return ret
395N/A
395N/A # override the build_module method to do VERSION substitution on
395N/A # pkg/__init__.py
395N/A def build_module (self, module, module_file, package):
395N/A
395N/A if module == "__init__" and package == "pkg":
395N/A versionre = '(?m)^VERSION[^"]*"([^"]*)"'
395N/A # Grab the previously-built version out of the build
395N/A # tree.
2180N/A try:
395N/A ocontent = \
290N/A file(self.get_module_outfile(self.build_lib,
383N/A [package], module)).read()
395N/A ov = re.search(versionre, ocontent).group(1)
395N/A except IOError:
395N/A ov = None
395N/A v = get_hg_version()
2046N/A vstr = 'VERSION = "%s"' % v
395N/A # If the versions haven't changed, there's no need to
290N/A # recompile.
290N/A if v == ov:
395N/A return
395N/A
395N/A mcontent = file(module_file).read()
395N/A mcontent = re.sub(versionre, vstr, mcontent)
1483N/A tmpfd, tmp_file = tempfile.mkstemp()
395N/A os.write(tmpfd, mcontent)
1498N/A os.close(tmpfd)
1498N/A print "doing version substitution: ", v
395N/A rv = _build_py.build_module(self, module, tmp_file, package)
290N/A os.unlink(tmp_file)
290N/A return rv
395N/A
395N/A # Will raise a DistutilsError on failure.
395N/A syntax_check(module_file)
613N/A
290N/A return _build_py.build_module(self, module, module_file, package)
395N/A
395N/A def copy_file(self, infile, outfile, preserve_mode=1, preserve_times=1,
395N/A link=None, level=1):
395N/A
395N/A # If the timestamp on the source file (coming from mercurial if
395N/A # unchanged, or from the filesystem if changed) doesn't match
395N/A # the filesystem timestamp on the destination, then force the
395N/A # copy to make sure the right data is in place.
290N/A
395N/A try:
395N/A dst_mtime = os.stat(outfile).st_mtime
395N/A except OSError, e:
395N/A if e.errno != errno.ENOENT:
395N/A raise
395N/A dst_mtime = time.time()
430N/A
395N/A # The timestamp for __init__.py is the timestamp for the
395N/A # workspace itself.
395N/A if outfile.endswith("/pkg/__init__.py"):
395N/A src_mtime = self.timestamps["."]
395N/A else:
395N/A src_mtime = self.timestamps.get(
691N/A os.path.join("src", infile), self.timestamps["."])
691N/A
691N/A if dst_mtime != src_mtime:
691N/A f = self.force
691N/A self.force = True
691N/A dst, copied = _build_py.copy_file(self, infile, outfile,
691N/A preserve_mode, preserve_times, link, level)
691N/A self.force = f
395N/A else:
395N/A dst, copied = outfile, 0
395N/A
395N/A # If we copied the file, then we need to go and readjust the
395N/A # timestamp on the file to match what we have in our database.
1516N/A if copied and dst.endswith(".py"):
1516N/A os.utime(dst, (src_mtime, src_mtime))
395N/A
395N/A return dst, copied
395N/A
395N/Aclass build_data_func(Command):
395N/A description = "build data files whose source isn't in deliverable form"
395N/A user_options = []
# As a subclass of distutils.cmd.Command, these methods are required to
# be implemented.
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# Anything that gets created here should get deleted in
# clean_func.run() below.
for f in intl_files:
intltool_merge(f, f[:-3])
for l in help_locales:
path = "gui/help/%s/" % l
xml2po(path + "package-manager.xml.in",
path + "package-manager.xml",
path + "%s.mo" % l)
for l in pkg_locales:
msgfmt("po/%s.po" % l, "po/%s.mo" % l)
def rm_f(filepath):
"""Remove a file without caring whether it exists."""
try:
os.unlink(filepath)
except OSError, e:
if e.errno != errno.ENOENT:
raise
class clean_func(_clean):
def initialize_options(self):
_clean.initialize_options(self)
self.build_base = build_dir
def run(self):
_clean.run(self)
rm_f("po/.intltool-merge-cache")
for f in intl_files:
rm_f(f[:-3])
for l in pkg_locales:
rm_f("po/%s.mo" % l)
for l in help_locales:
path = "gui/help/%s/" % l
rm_f(path + "package-manager.xml")
rm_f(path + "%s.mo" % l)
class clobber_func(Command):
user_options = []
description = "Deletes any and all files created by setup"
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# nuke everything
print("deleting " + dist_dir)
shutil.rmtree(dist_dir, True)
print("deleting " + build_dir)
shutil.rmtree(build_dir, True)
print("deleting " + root_dir)
shutil.rmtree(root_dir, True)
print("deleting " + pkgs_dir)
shutil.rmtree(pkgs_dir, True)
print("deleting " + extern_dir)
shutil.rmtree(extern_dir, True)
class test_func(Command):
# NOTE: these options need to be in sync with tests/run.py and the
# list of options stored in initialize_options below. The first entry
# in each tuple must be the exact name of a member variable.
user_options = [
("archivedir=", 'a', "archive failed tests <dir>"),
("baselinefile=", 'b', "baseline file <file>"),
("coverage", "c", "collect code coverage data"),
("genbaseline", 'g', "generate test baseline"),
("only=", "o", "only <regex>"),
("parseable", 'p', "parseable output"),
("port=", "z", "lowest port to start a depot on"),
("timing", "t", "timing file <file>"),
("verbosemode", 'v', "run tests in verbose mode"),
("enableguitests", 'u', "enable IPS GUI tests, disabled by default"),
("stoponerr", 'x', "stop when a baseline mismatch occurs"),
("debugoutput", 'd', "emit debugging output"),
("showonexpectedfail", 'f',
"show all failure info, even for expected fails"),
("startattest=", 's', "start at indicated test"),
("jobs=", 'j', "number of parallel processes to use"),
("quiet", "q", "use the dots as the output format"),
]
description = "Runs unit and functional tests"
def initialize_options(self):
self.only = ""
self.baselinefile = ""
self.verbosemode = 0
self.parseable = 0
self.genbaseline = 0
self.timing = 0
self.coverage = 0
self.stoponerr = 0
self.debugoutput = 0
self.showonexpectedfail = 0
self.startattest = ""
self.archivedir = ""
self.port = 12001
self.jobs = 1
self.quiet = False
def finalize_options(self):
pass
def run(self):
os.putenv('PYEXE', sys.executable)
os.chdir(os.path.join(pwd, "tests"))
# Reconstruct the cmdline and send that to run.py
cmd = [sys.executable, "run.py"]
args = ""
if "test" in sys.argv:
args = sys.argv[sys.argv.index("test")+1:]
cmd.extend(args)
subprocess.call(cmd)
class dist_func(_bdist):
def initialize_options(self):
_bdist.initialize_options(self)
self.dist_dir = dist_dir
# These are set to real values based on the platform, down below
compile_args = None
if osname in ("sunos", "linux", "darwin"):
compile_args = [ "-O3" ]
if osname == "sunos":
link_args = [ "-zstrip-class=nonalloc" ]
else:
link_args = []
ext_modules = [
Extension(
'actions._actions',
_actions_srcs,
include_dirs = include_dirs,
extra_compile_args = compile_args,
extra_link_args = link_args
),
Extension(
'solver',
solver_srcs,
include_dirs = include_dirs + ["."],
extra_compile_args = compile_args,
extra_link_args = link_args + solver_link_args,
define_macros = [('_FILE_OFFSET_BITS', '64')]
),
]
elf_libraries = None
data_files = web_files
cmdclasses = {
'install': install_func,
'install_data': install_data_func,
'build': build_func,
'build_data': build_data_func,
'build_ext': build_ext_func,
'build_py': build_py_func,
'bdist': dist_func,
'lint': lint_func,
'clint': clint_func,
'pylint': pylint_func,
'pylint_quiet': pylint_func_quiet,
'clean': clean_func,
'clobber': clobber_func,
'test': test_func,
'installfile': installfile,
}
# all builds of IPS should have manpages
data_files += [
(man1_dir, man1_files),
(man1m_dir, man1m_files),
(man5_dir, man5_files),
(man1_ja_JP_dir, man1_ja_files),
(man1m_ja_JP_dir, man1m_ja_files),
(man5_ja_JP_dir, man5_ja_files),
(man1_zh_CN_dir, man1_zh_CN_files),
(man1m_zh_CN_dir, man1m_zh_CN_files),
(man5_zh_CN_dir, man5_zh_CN_files),
(resource_dir, resource_files),
]
# add transforms
data_files += [
(transform_dir, transform_files)
]
if osname == 'sunos':
# Solaris-specific extensions are added here
data_files += [
(smf_app_dir, smf_app_files),
(execattrd_dir, execattrd_files),
(authattrd_dir, authattrd_files),
(sysrepo_dir, sysrepo_files),
(sysrepo_logs_dir, sysrepo_log_stubs),
(sysrepo_cache_dir, {}),
(autostart_dir, autostart_files),
(desktop_dir, desktop_files),
(gconf_dir, gconf_files),
(omf_dir, omf_files),
('usr/share/icons/hicolor/48x48/mimetypes',
['gui/data/gnome-mime-application-vnd.pkg5.info.png']),
('usr/share/mime/packages', ['gui/data/packagemanager-info.xml']),
(pm_share_dir, ['gui/data/packagemanager.ui']),
]
data_files += [
(os.path.join(startpage_dir, locale), files)
for locale, files in startpage_files.iteritems()
]
data_files += [
(os.path.join(help_dir, locale), files)
for locale, files in help_files.iteritems()
]
data_files += [
(os.path.join(locale_dir, locale, 'LC_MESSAGES'),
[('po/%s.mo' % locale, 'pkg.mo')])
for locale in pkg_locales
]
for t in 'HighContrast', 'HighContrastInverse', '':
for px in '24', '36', '48':
data_files += [(
'%s/icons/%s/%sx%s/actions' % (um_share_dir, t or 'hicolor', px, px),
['um/data/icons/%s/%sx%s/updatemanager.png' % (t, px, px)]
)]
data_files += [(
'%s/icons/%s/16x16/actions' % (pm_share_dir, t or 'hicolor'),
[
'gui/data/icons/%s/16x16/%s.png' % (t, n)
for n in ('filter_all', 'filter_selected', 'progress_checkmark',
'selection', 'status_checkmark', 'status_installed',
'status_newupdate', 'status_notinstalled')
]
)]
data_files += [
('%s/icons/%s/%sx%s/actions' % (pm_share_dir, t or 'hicolor', px, px),
[
'gui/data/icons/%s/%sx%s/%s.png' % (t, px, px, n)
for n in ('pm-install_update', 'pm-refresh',
'pm-remove', 'pm-update_all')
])
for px in (24, 48)
]
data_files += [(
'%s/icons/%s/48x48/actions' % (pm_share_dir, t or 'hicolor'),
['gui/data/icons/%s/48x48/packagemanager.png' % t]
)]
data_files += [
('usr/share/icons/%s/48x48/apps' % (t or 'hicolor'),
[
'um/data/icons/%s/48x48/updatemanager.png' % t,
'gui/data/icons/%s/48x48/packagemanager.png' % t
]),
]
# These two icons don't fit any patterns.
data_files += [
(os.path.join(pm_share_dir, 'icons/hicolor/16x16/actions'), [
'gui/data/icons/16x16/progress_blank.png']),
(os.path.join(pm_share_dir, 'icons/hicolor/24x24/actions'), [
'gui/data/icons/24x24/pm-check.png']),
]
if osname == 'sunos' or osname == "linux":
# Unix platforms which the elf extension has been ported to
# are specified here, so they are built automatically
elf_libraries = ['elf']
ext_modules += [
Extension(
'elf',
elf_srcs,
include_dirs = include_dirs,
libraries = elf_libraries,
extra_compile_args = compile_args,
extra_link_args = link_args
),
]
# Solaris has built-in md library and Solaris-specific arch extension
# All others use OpenSSL and cross-platform arch module
if osname == 'sunos':
elf_libraries += [ 'md' ]
ext_modules += [
Extension(
'arch',
arch_srcs,
include_dirs = include_dirs,
extra_compile_args = compile_args,
extra_link_args = link_args,
define_macros = [('_FILE_OFFSET_BITS', '64')]
),
Extension(
'pspawn',
pspawn_srcs,
include_dirs = include_dirs,
extra_compile_args = compile_args,
extra_link_args = link_args,
define_macros = [('_FILE_OFFSET_BITS', '64')]
),
Extension(
'syscallat',
syscallat_srcs,
include_dirs = include_dirs,
extra_compile_args = compile_args,
extra_link_args = link_args,
define_macros = [('_FILE_OFFSET_BITS', '64')]
),
]
else:
elf_libraries += [ 'ssl' ]
setup(cmdclass = cmdclasses,
name = 'pkg',
version = '0.1',
package_dir = {'pkg':'modules'},
packages = packages,
data_files = data_files,
ext_package = 'pkg',
ext_modules = ext_modules,
)