Skip to content

Commit 77677ba

Browse files
committed
folium issue #50 - fixed setup.py to package all the files in templates/tiles.
1 parent e5ba5ff commit 77677ba

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

setup.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
# -*- coding: utf-8 -*-
2+
import os
23

34
try:
45
from setuptools import setup
56
except ImportError:
67
from distutils.core import setup
78

9+
def walk_subpkg(name):
10+
data_files = []
11+
package_dir = 'folium'
12+
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
14+
for f in files:
15+
data_files.append(os.path.join(sub_dir, f))
16+
return data_files
17+
18+
pkg_data = {
19+
'': ['*.js',
20+
'templates/*.html',
21+
'templates/*.js',
22+
'templates/*.txt'] + walk_subpkg('templates/tiles')
23+
}
24+
825
setup(
926
name='folium',
1027
version='0.1.2',
@@ -18,9 +35,5 @@
1835
'Programming Language :: Python :: 2.7',
1936
'License :: OSI Approved :: MIT License'],
2037
packages=['folium'],
21-
package_data={'': ['*.js',
22-
'templates/*.html',
23-
'templates/*.js',
24-
'templates/*.txt',
25-
'plugins/*.js']}
38+
package_data=pkg_data
2639
)

0 commit comments

Comments
 (0)