File: setup.py

package info (click to toggle)
python-stem 1.2.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,568 kB
  • ctags: 2,036
  • sloc: python: 20,108; makefile: 127; sh: 3
file content (58 lines) | stat: -rw-r--r-- 1,689 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python
# Copyright 2012-2014, Damian Johnson and The Tor Project
# See LICENSE for licensing information

# We cannot import anything from the stem module since this would risk
# importing code that does not work under python 3 *without* being converted.
#
# I hate to do this, but reading our module file's information directly.

import os
import re
from distutils.core import setup

STAT_LINE = re.compile(r"^__(.+)__ = '(.+)'$")

DESCRIPTION = """\
Stem is a Python controller library that allows applications to interact with
Tor <https://www.torproject.org/>."""

def get_module_info():
  # reads the basic __stat__ strings from our module's init

  result = {}
  cwd = os.path.sep.join(__file__.split(os.path.sep)[:-1])

  with open(os.path.join(cwd, 'stem', '__init__.py')) as init_file:
    for line in init_file.readlines():
      line_match = STAT_LINE.match(line)

      if line_match:
        keyword, value = line_match.groups()
        result[keyword] = value

  return result

try:
  from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
  from distutils.command.build_py import build_py

module_info = get_module_info()

setup(
  name = 'stem',
  version = module_info['version'],
  description = DESCRIPTION,
  license = module_info['license'],
  author = module_info['author'],
  author_email = module_info['contact'],
  url = module_info['url'],
  packages = ['stem', 'stem.descriptor', 'stem.interpreter', 'stem.response', 'stem.util'],
  provides = ['stem'],
  cmdclass = {'build_py': build_py},
  keywords = 'tor onion controller',
  scripts = ['tor-prompt'],
  package_data = { 'stem.interpreter': ['settings.cfg']},
)