summaryrefslogtreecommitdiff
path: root/service/setup.py
blob: 3ed56b3e67d7da6421569fdc469a72acf987570b (plain)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/env python
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pixelated is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Pixelated. If not, see <http://www.gnu.org/licenses/>.

import sys
if 'develop' in sys.argv:
    sys.argv.append('--always-unzip')

# next line is a fix to this error that occurs with nose > 1.1.2 and the debian
# python: http://bugs.python.org/issue15881#msg170215
import multiprocessing

import setuptools
from setuptools import setup
from collections import defaultdict
import os


def _folder_for(file):
    broken_path = file.split('/')
    new_path = "web-ui/app/" + "/".join(broken_path[3:(len(broken_path) - 1)])
    return new_path[0:-1] if new_path[-1] == '/' else new_path


def _create_data_files(original_files):
    data_files_hash = defaultdict(list)

    for file in original_files:
        data_files_hash[_folder_for(file)].append(file)

    return data_files_hash.items()


def _web_ui_files():
    web_ui_files = []
    for root, dirname, filenames in os.walk('../web-ui/dist'):
        for filename in filenames:
            web_ui_files.append(os.path.join(root, filename))
    return web_ui_files


def data_files():
    certificates = ('pixelated/certificates', ['pixelated/certificates/example.wazokazi.is.ca.crt'])

    _data_files = _create_data_files(_web_ui_files())
    _data_files.append(certificates)

    return _data_files


def read(fname):
    return open(os.path.join(os.path.dirname(__file__), fname)).read()

setup(name='pixelated-user-agent',
      version='0.1',
      description='API to serve the pixelated front-end requests',
      long_description=read('README.md'),
      author='Thoughtworks',
      author_email='pixelated-team@thoughtworks.com',
      url='http://pixelated-project.github.io',
      packages=['pixelated', 'pixelated.adapter', 'pixelated.bitmask_libraries', 'pixelated.config', 'pixelated.certificates', 'pixelated.support', 'pixelated.controllers'],
      test_suite='nose.collector',
      install_requires=[
          'pyasn1==0.1.7',
          'gnupg==1.4.0',
          'Twisted==14.0.2',
          'service-identity==14.0.0',
          'klein==0.2.3',
          'requests==2.4.3',
          'srp==1.0.5',
          'dirspec==13.10',
          'u1db==13.09',
          'leap.keymanager==0.3.8',
          'leap.soledad.common>=0.6',
          'leap.soledad.client>=0.6',
          'leap.mail==0.3.9-1-gc1f9c92',
          'whoosh==2.6.0'
      ],
      entry_points={
          'console_scripts': [
              'pixelated-user-agent = pixelated.runserver:setup'
          ]
      },
      data_files=data_files(),
      include_package_data=True
      )