~pythonxy/pythonxy-upstream/python-folium-wrobstory

59.1.3 by ocefpaf
Added plugins directory to `pkg_data`.
1
# -*- coding: utf-8 -*-
72.1.1 by ocefpaf
Added CHANGELOG.
2
59.1.3 by ocefpaf
Added plugins directory to `pkg_data`.
3
import os
67.2.1 by ocefpaf
Easy tag and publish via `setup.py`.
4
import sys
110.1.1 by ocefpaf
Using py.test instead of nose.
5
from setuptools import setup
6
from setuptools.command.test import test as TestCommand
59.1.3 by ocefpaf
Added plugins directory to `pkg_data`.
7
72.1.1 by ocefpaf
Added CHANGELOG.
8
rootpath = os.path.abspath(os.path.dirname(__file__))
9
10
110.1.1 by ocefpaf
Using py.test instead of nose.
11
class PyTest(TestCommand):
12
    def finalize_options(self):
13
        TestCommand.finalize_options(self)
115.1.1 by ocefpaf
Fix Travis-CI
14
        self.verbose = True
110.1.1 by ocefpaf
Using py.test instead of nose.
15
16
    def run_tests(self):
17
        import pytest
18
        errno = pytest.main(self.test_args)
19
        sys.exit(errno)
20
21
72.1.1 by ocefpaf
Added CHANGELOG.
22
def read(*parts):
110.1.1 by ocefpaf
Using py.test instead of nose.
23
    return open(os.path.join(rootpath, *parts), 'r').read()
24
25
26
def extract_version(module='folium'):
27
    version = None
28
    fname = os.path.join(rootpath, module, '__init__.py')
29
    with open(fname) as f:
30
        for line in f:
31
            if (line.startswith('__version__')):
32
                _, version = line.split('=')
33
                version = version.strip()[1:-1]  # Remove quotation characters.
34
                break
35
    return version
72.1.1 by ocefpaf
Added CHANGELOG.
36
63.1.1 by ocefpaf
Moved version string to `folium/__init__.py`.
37
59.1.3 by ocefpaf
Added plugins directory to `pkg_data`.
38
def walk_subpkg(name):
39
    data_files = []
40
    package_dir = 'folium'
41
    for parent, dirs, files in os.walk(os.path.join(package_dir, name)):
63.1.1 by ocefpaf
Moved version string to `folium/__init__.py`.
42
        # Remove package_dir from the path.
43
        sub_dir = os.sep.join(parent.split(os.sep)[1:])
59.1.3 by ocefpaf
Added plugins directory to `pkg_data`.
44
        for f in files:
45
            data_files.append(os.path.join(sub_dir, f))
46
    return data_files
47
72.1.1 by ocefpaf
Added CHANGELOG.
48
49
pkg_data = {'': ['*.js',
50
                 'plugins/*.js',
97.2.3 by Martin Journois
timestampedGeoJson plugin based on Leaflet.Timedimension
51
                 'plugins/*.html',
52
                 'plugins/*.css',
53
                 'plugins/*.tpl',
72.1.1 by ocefpaf
Added CHANGELOG.
54
                 'templates/*.html',
55
                 'templates/*.js',
56
                 'templates/*.txt'] + walk_subpkg('templates/tiles')}
97.2.1 by Martin Journois
plugin objects definition, with two examples
57
pkgs = ['folium',
110.1.1 by ocefpaf
Using py.test instead of nose.
58
        'folium.plugins']
72.1.1 by ocefpaf
Added CHANGELOG.
59
60
LICENSE = read('LICENSE.txt')
96.1.1 by Filipe Fernandes
Fist step towards better docs.
61
long_description = '{}\n{}'.format(read('README.rst'), read('CHANGES.txt'))
72.1.1 by ocefpaf
Added CHANGELOG.
62
110.1.1 by ocefpaf
Using py.test instead of nose.
63
# Dependencies.
64
with open('requirements.txt') as f:
65
    tests_require = f.readlines()
66
install_requires = [t.strip() for t in tests_require]
67
68
72.1.1 by ocefpaf
Added CHANGELOG.
69
config = dict(name='folium',
110.1.1 by ocefpaf
Using py.test instead of nose.
70
              version=extract_version(),
72.1.1 by ocefpaf
Added CHANGELOG.
71
              description='Make beautiful maps with Leaflet.js & Python',
72
              long_description=long_description,
73
              author='Rob Story',
74
              author_email='wrobstory@gmail.com',
75
              url='https://github.com/python-visualization/folium',
76
              keywords='data visualization',
115.1.1 by ocefpaf
Fix Travis-CI
77
              classifiers=['Programming Language :: Python :: 2.7',
72.1.1 by ocefpaf
Added CHANGELOG.
78
                           'Programming Language :: Python :: 3.3',
79
                           'Programming Language :: Python :: 3.4',
115.1.1 by ocefpaf
Fix Travis-CI
80
                           'Programming Language :: Python :: 3.5',
81
                           'License :: OSI Approved :: MIT License',
82
                           'Development Status :: 5 - Production/Stable'],
97.2.1 by Martin Journois
plugin objects definition, with two examples
83
              packages=pkgs,
74.1.1 by ocefpaf
Using zip_safe=False.
84
              package_data=pkg_data,
110.1.1 by ocefpaf
Using py.test instead of nose.
85
              cmdclass=dict(test=PyTest),
86
              tests_require=['pytest'],
87
              license=LICENSE,
88
              install_requires=install_requires,
74.1.1 by ocefpaf
Using zip_safe=False.
89
              zip_safe=False)
72.1.1 by ocefpaf
Added CHANGELOG.
90
91
92
setup(**config)