-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
81 lines (71 loc) · 2.65 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
75
76
77
78
79
80
81
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
print("Running svg reader.")
super(BuildIconsCommand, self).run()
build_file = path.join('build', 'lib', 'flask_lucide', 'icons.py')
icon_dir = path.join('lucide', '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
icons.write('i = {')
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(' />', '/>')
svg = ('><').join(svg.split('><')[1:-1])
# Add to the build file
icons.write(" \'%s\': \'%s\'\n," % (icon_name, svg))
icons.write(' }')
with open("README.md", "r") as fh:
long_description = fh.read()
install_requires = [
'flask>=1.1',
'Jinja2'
]
testing_extras = []
setup(
name='flask-lucide',
version='0.2.0',
options={'bdist_wheel': {'universal': True}},
author='Wouter Kayser',
author_email='wouterkayser@gmail.com',
cmdclass={
'build_py': BuildIconsCommand
},
description='A simple Tag to implement Lucide Icons in Flask',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/WAKayser/flask-lucide',
package_dir={'': 'src'},
packages=find_packages(where='src'),
package_data=['flask_lucide', ["py.typed"]],
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',
'Programming Language :: Python :: 3.9',
"Operating System :: OS Independent",
]
)