File: setup.py

package info (click to toggle)
python-steamodd 5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 304 kB
  • sloc: python: 2,224; makefile: 162
file content (54 lines) | stat: -rw-r--r-- 1,777 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
"""
Copyright (c) 2010+, Anthony Garcia <anthony@lagg.me>
Distributed under the ISC License (see LICENSE)
"""

from setuptools import setup, Command
from setuptools.errors import OptionError
from unittest import TestLoader, TextTestRunner
import sys
import steam

class run_tests(Command):
    description = "Run the steamodd unit tests"

    user_options = [
            ("key=", 'k', "Your API key")
            ]

    def initialize_options(self):
        try:
            self.key = steam.api.key.get()
        except steam.api.APIKeyMissingError:
            self.key = None

    def finalize_options(self):
        if not self.key:
            raise OptionError("API key is required")
        else:
            steam.api.key.set(self.key)

        # Generous timeout so slow server days don't cause failed builds
        steam.api.socket_timeout.set(20)

    def run(self):
        tests = TestLoader().discover("tests")
        results = TextTestRunner(verbosity = 2).run(tests)
        sys.exit(int(not results.wasSuccessful()))

setup(name = "steamodd",
      version = steam.__version__,
      description = "High level Steam API implementation with low level reusable core",
      long_description = "Please see the `README <https://github.com/Lagg/steamodd/blob/master/README.md>`_ for a full description.",
      packages = ["steam"],
      author = steam.__author__,
      author_email = steam.__contact__,
      url = "https://github.com/Lagg/steamodd",
      classifiers = [
          "License :: OSI Approved :: ISC License (ISCL)",
          "Intended Audience :: Developers",
          "Operating System :: OS Independent",
          "Programming Language :: Python"
          ],
      license = steam.__license__,
      cmdclass = {"run_tests": run_tests})