forked from TheTomcat/Flask-Feather
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
75 lines (66 loc) · 2.38 KB
/
setup.py
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
import os
import re
from os import path
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
class BuildIconsCommand(build_py):
"""Custom Build Icons Command
"""
def run(self):
# First copy all files
super(BuildIconsCommand, self).run()
build_file = path.join('build', 'lib', 'flask_feather','icons.py')
icon_dir = path.join('feather', 'icons')
files = [f for f in os.listdir(icon_dir)
if path.isfile(path.join(icon_dir, f))]
with open(build_file, 'w') as icons:
# Open the build file once, then iterate over all icons
for file in files:
icon_name = str(file.split('.')[0]).replace('-', '_')
with open(path.join(icon_dir, file), 'r') as icon:
svg = icon.read()
# Modify the svg, remove line and spaces
svg = re.sub(r'\n', r' ', svg)
svg = re.sub(r'\s+', r' ', svg)
svg = svg.replace('> <', '><').replace(' />', '/>')
# Add to the build file
icons.write("%s = \'%s\'%s" % (icon_name, svg, os.linesep))
with open("README.md", "r") as fh:
long_description = fh.read()
install_requires = [
'flask>=1.1',
'Jinja2'
]
testing_extras = []
setup(
name='flask-feather',
version='0.1.0',
author='Tom Vos',
author_email='[email protected]',
cmdclass={
'build_py': BuildIconsCommand
},
description='A simple Tag to implement Feather Icons in Flask',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/thetomcat/flask-feather',
# py_modules=["flask_feather"],
package_dir= {'':'src'},
packages=find_packages(where='src'),
include_package_data=True,
install_requires=install_requires,
extras_require={
'dev': ["pytest>=3.7", 'twine>=3.2', 'check-manifest'],
},
classifiers=[
'Development Status :: 3 - Alpha',
'Framework :: Flask',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
"Operating System :: OS Independent",
]
)