1#!/usr/bin/env python
2# Copyright 2009 Google Inc. All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
17"""distutils configuration: python setup.py install"""
18
19__author__ = 'tstromberg@google.com (Thomas Stromberg)'
20
21import os
22from libnamebench import version
23from distutils.core import setup
24try:
25    import py2exe
26except ImportError:
27    pass
28
29# If you don't want 3rd party libraries included, set this in your environment.
30if os.getenv('NO_THIRD_PARTY', None):
31  packages=['libnamebench']
32else:
33  packages = [
34      'libnamebench',
35      'nb_third_party',
36      'nb_third_party/dns',
37      'nb_third_party/dns/rdtypes',
38      'nb_third_party/dns/rdtypes/ANY',
39      'nb_third_party/dns/rdtypes/IN',
40      'nb_third_party/graphy',
41      'nb_third_party/jinja2',
42      'nb_third_party/httplib2',
43      'nb_third_party/simplejson',
44      'nb_third_party/graphy/backends',
45      'nb_third_party/graphy/backends/google_chart_api'
46  ]
47
48
49
50RT_MANIFEST = 24
51
52manifest_template = '''
53<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
54<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
55<assemblyIdentity
56    version="5.0.0.0"
57    processorArchitecture="x86"
58    name="%(prog)s"
59    type="win32"
60/>
61<description>%(prog)s Program</description>
62<dependency>
63    <dependentAssembly>
64        <assemblyIdentity
65            type="win32"
66            name="Microsoft.Windows.Common-Controls"
67            version="6.0.0.0"
68            processorArchitecture="X86"
69            publicKeyToken="6595b64144ccf1df"
70            language="*"
71        />
72    </dependentAssembly>
73</dependency>
74</assembly>
75'''
76
77rt90_manifest = """<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
78  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
79    <security>
80      <requestedPrivileges>
81        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
82      </requestedPrivileges>
83    </security>
84  </trustInfo>
85  <dependency>
86    <dependentAssembly>
87      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
88    </dependentAssembly>
89  </dependency>
90</assembly>
91"""
92
93setup(name='namebench',
94      version=version.VERSION,
95      py_modules=['namebench'],
96      description='DNS service benchmarking tool',
97      author='Thomas Stromberg',
98      author_email='tstromberg@google.com',
99      url='http://namebench.googlecode.com/',
100      classifiers=[
101          'Development Status :: 4 - Beta',
102          'Environment :: Console',
103          'Intended Audience :: End Users/Desktop',
104          'Intended Audience :: System Administrators',
105          'License :: OSI Approved :: Apache 2.0',
106          'Operating System :: MacOS :: MacOS X',
107          'Operating System :: Microsoft :: Windows',
108          'Operating System :: POSIX',
109          'Programming Language :: Python',
110          'Topic :: Networking',
111      ],
112      packages=packages,
113      platforms=['Any'],
114      license='Apache 2.0',
115      scripts=['namebench.py'],
116      data_files=[
117          ('namebench/config',
118           ['config/namebench.cfg',
119            'config/hostname_reference.cfg',
120            'config/data_sources.cfg']
121          ),
122          ('namebench/templates',
123           ['templates/ascii.tmpl',
124            'templates/html.tmpl',
125            'templates/resolv.conf.tmpl',
126            'templates/style.css'
127           ]
128          ),
129          ('namebench/data',
130           ['data/alexa-top-2000-domains.txt',
131            'data/cache-hit.txt',
132            'data/cache-miss.txt',
133            'data/cache-mix.txt'
134           ]
135          )
136      ],
137
138      # py2exe specific garbarge below.
139        options={
140            'py2exe': {
141                'bundle_files': 3, # 1 nor 2 does not work
142                'ascii': False,
143                'packages': ['nb_third_party'],
144                'excludes': ['dns', 'jinja2', 'graphy', 'httplib2', 'tcl', 'simplejson'],
145                'dll_excludes': ["w9xpopen.exe","MSVCP90.dll", "MSVCR90.DLL"],
146            }
147        },
148        zipfile = "namebench.zip", # None - when bundle_files 1 or 2 can work.
149        windows=[{
150            'script': "namebench.py",
151            'dest_base': "namebench",
152            'name': "namebench",
153            'copyright': "(c) 2009 Google, Inc.",
154            'comments': "http://namebench.googlecode.com/",
155            'other_resources': [
156                # Windows Common Controls, XP Look
157                (RT_MANIFEST, 1, manifest_template % dict(prog="namebench")),
158                # VCRT 2008
159                (RT_MANIFEST, 1, rt90_manifest), # 1 - EXE CRT Manifest, 2 - DLL
160            ],
161        }],
162#       console=['namebench.py']
163)
164