Skip to content

Commit 1810e33

Browse files
committed
Merge pull request #60 from ocefpaf/version_string
Moved version string to `folium/__init__.py`.
2 parents df33b82 + 9c330ae commit 1810e33

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

folium/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from __future__ import absolute_import
3+
4+
__version__ = '0.1.3'
5+
36
from folium.folium import Map, initialize_notebook

setup.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,43 @@
11
# -*- coding: utf-8 -*-
22
import os
33

4+
import re
5+
VERSIONFILE = "folium/__init__.py"
6+
verstrline = open(VERSIONFILE, "rt").read()
7+
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
8+
mo = re.search(VSRE, verstrline, re.M)
9+
if mo:
10+
verstr = mo.group(1)
11+
else:
12+
raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,))
13+
414
try:
515
from setuptools import setup
616
except ImportError:
717
from distutils.core import setup
818

19+
920
def walk_subpkg(name):
1021
data_files = []
1122
package_dir = 'folium'
1223
for parent, dirs, files in os.walk(os.path.join(package_dir, name)):
13-
sub_dir = os.sep.join(parent.split(os.sep)[1:]) # remove package_dir from the path
24+
# Remove package_dir from the path.
25+
sub_dir = os.sep.join(parent.split(os.sep)[1:])
1426
for f in files:
1527
data_files.append(os.path.join(sub_dir, f))
1628
return data_files
1729

1830
pkg_data = {
19-
'': ['*.js',
20-
'plugins/*.js',
21-
'templates/*.html',
22-
'templates/*.js',
23-
'templates/*.txt'] + walk_subpkg('templates/tiles')
31+
'': ['*.js',
32+
'plugins/*.js',
33+
'templates/*.html',
34+
'templates/*.js',
35+
'templates/*.txt'] + walk_subpkg('templates/tiles')
2436
}
2537

2638
setup(
2739
name='folium',
28-
version='0.1.3',
40+
version=verstr,
2941
description='Make beautiful maps with Leaflet.js & Python',
3042
author='Rob Story',
3143
author_email='[email protected]',
@@ -34,6 +46,8 @@ def walk_subpkg(name):
3446
keywords='data visualization',
3547
classifiers=['Development Status :: 4 - Beta',
3648
'Programming Language :: Python :: 2.7',
49+
'Programming Language :: Python :: 3.3',
50+
'Programming Language :: Python :: 3.4',
3751
'License :: OSI Approved :: MIT License'],
3852
packages=['folium'],
3953
package_data=pkg_data

0 commit comments

Comments
 (0)