~sircmpwn/meta.sr.ht

ref: e0be9dcd8e96f952547c243e078c47571f54fca2 meta.sr.ht/setup.py -rwxr-xr-x 2.2 KiB
e0be9dcdDrew DeVault billing.py: fix leap day error 1 year, 8 months ago
                                                                                
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
81
82
#!/usr/bin/env python3
from setuptools import setup
import subprocess
import os
import site
import sys

if hasattr(site, 'getsitepackages'):
    pkg_dirs = site.getsitepackages()
    if site.getusersitepackages():
        pkg_dirs.append(site.getusersitepackages())
    for pkg_dir in pkg_dirs:
        srht_path = os.path.join(pkg_dir, "srht")
        if os.path.isdir(srht_path):
            break
    else:
        raise Exception("Can't find core srht module in your site packages "
            "directories. Please install it first.")
else:
    srht_path = os.getenv("SRHT_PATH")
    if not srht_path:
        raise Exception("You're running inside a virtual environment. "
            "Due to virtualenv limitations, you need to set the "
            "$SRHT_PATH environment variable to the path of the "
            "core srht module.")
    elif not os.path.isdir(srht_path):
        raise Exception(
            "The $SRHT_PATH environment variable points to an invalid "
            "directory: {}".format(srht_path))

make = os.environ.get("MAKE") or "make"
subp = subprocess.run([make, "SRHT_PATH=" + srht_path])
if subp.returncode != 0:
    sys.exit(subp.returncode)

ver = os.environ.get("PKGVER") or subprocess.run(['git', 'describe', '--tags'],
      stdout=subprocess.PIPE).stdout.decode().strip()

setup(
  name = 'metasrht',
  packages = [
      'metasrht',
      'metasrht.types',
      'metasrht.blueprints',
      'metasrht.blueprints.api',
      'metasrht.alembic',
      'metasrht.alembic.versions'
  ],
  version = ver,
  description = 'meta.sr.ht website',
  author = 'Drew DeVault',
  author_email = 'sir@cmpwn.com',
  url = 'https://git.sr.ht/~sircmpwn/meta.sr.ht',
  install_requires = [
      'alembic',
      'bcrypt',
      'pgpy',
      'pystache',
      'qrcode',
      'redis',
      'srht',
      'sshpubkeys',
      'stripe',
      'prometheus_client',
      'weasyprint',
      'zxcvbn'
  ],
  license = 'AGPL-3.0',
  package_data={
      'metasrht': [
          'templates/*.html',
          'static/*',
          'static/icons/*',
          'emails/*'
      ]
  },
  scripts = [
      'metasrht-daily',
      'metasrht-migrate',
      'metasrht-invoicestats',
  ]
)