File: setup.py

package info (click to toggle)
google-apputils-python 0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, sid, stretch
  • size: 448 kB
  • ctags: 512
  • sloc: python: 2,094; makefile: 18
file content (80 lines) | stat: -rw-r--r-- 2,783 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python
# Copyright 2010 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

from setuptools import setup, find_packages
from setuptools.command import test

REQUIRE = [
    "python-dateutil>=1.4",
    "python-gflags>=1.4",
    "pytz>=2010",
    ]

TEST_REQUIRE = ["mox>=0.5"]

if sys.version_info[:2] < (2, 7):
  # unittest2 is a backport of Python 2.7's unittest.
  TEST_REQUIRE.append("unittest2>=0.5.1")


# Mild hackery to get around the fact that we want to include a
# GoogleTest as one of the cmdclasses for our package, but we
# can't reference it until our package is installed. We simply
# make a wrapper class that actually creates objects of the
# appropriate class at runtime.
class GoogleTestWrapper(test.test, object):
  test_dir = None

  def __new__(cls, *args, **kwds):
    from google.apputils import setup_command
    dist = setup_command.GoogleTest(*args, **kwds)
    dist.test_dir = GoogleTestWrapper.test_dir
    return dist

setup(
    name="google-apputils",
    version="0.4.1",
    packages=find_packages(exclude=["tests"]),
    namespace_packages=["google"],
    entry_points={
        "distutils.commands": [
            "google_test = google.apputils.setup_command:GoogleTest",
            ],

        "distutils.setup_keywords": [
            ("google_test_dir = google.apputils.setup_command"
             ":ValidateGoogleTestDir"),
            ],
        },

    install_requires=REQUIRE,
    tests_require=REQUIRE + TEST_REQUIRE,

    # The entry_points above allow other projects to understand the
    # google_test command and test_dir option by specifying
    # setup_requires("google-apputils"). However, those entry_points only get
    # registered when this project is installed, and we need to run Google-style
    # tests for this project before it is installed. So we need to manually set
    # up the command and option mappings, for this project only, and we use
    # a wrapper class that exists before the install happens.
    cmdclass={"google_test": GoogleTestWrapper},
    command_options={"google_test": {"test_dir": ("setup.py", "tests")}},

    author="Google Inc.",
    author_email="opensource@google.com",
    url="http://code.google.com/p/google-apputils-python",
    )