File indexing completed on 2025-01-05 04:00:33

0001 #!/usr/bin/env python3
0002 import os
0003 import setuptools
0004 from functools import reduce
0005 here = os.path.dirname(os.path.abspath(__file__))
0006 
0007 
0008 # Works fine everywhere without `encoding` except on giltab CI *shrugs*
0009 with open(os.path.join(here, "README.md"), "r", encoding='utf8') as fh:
0010     long_description = fh.read()
0011 
0012 
0013 def find_packages(root="lottie"):
0014     absroot = os.path.join(here, "lib", root)
0015     paks = [root]
0016     for sub in os.listdir(absroot):
0017         if sub == "__pycache__":
0018             continue
0019         lname = os.path.join(root, sub)
0020         if os.path.isdir(os.path.join(absroot, sub)):
0021             paks += [lname]
0022             paks += find_packages(lname)
0023     return paks
0024 
0025 
0026 vfdir = os.path.dirname(os.path.abspath(__file__))
0027 if not os.path.isfile(os.path.join(vfdir, ".version_full")):
0028     with open(os.path.join(vfdir, "version")) as vf:
0029         version = vf.read().strip() + "+src"
0030     with open(os.path.join(vfdir, ".version_full"), "w") as vf:
0031         vf.write(version)
0032 else:
0033     with open(os.path.join(vfdir, ".version_full")) as vf:
0034         version = vf.read().strip()
0035 
0036 extras_require = {
0037     "trace": ["pillow", "pypotrace>=0.2", "numpy", "scipy"],
0038     "images": ["pillow"],
0039     "PNG": ["cairosvg"],
0040     "GIF": ["cairosvg", "pillow"],
0041     "text": ["fonttools"],
0042     "video": ["opencv-python", "pillow", "numpy"],
0043     "emoji": ["grapheme"],
0044     "GUI": ["QScintilla"],
0045 }
0046 extras_require["all"] = list(reduce(lambda a, b: a | b, map(set, extras_require.values())))
0047 
0048 setuptools.setup(
0049     name="lottie",
0050     version=version,
0051     author="Mattia Basaglia",
0052     author_email="mattia.basaglia@gmail.com",
0053     description="A framework to work with lottie files and telegram animated stickers (tgs)",
0054     long_description=long_description,
0055     long_description_content_type="text/markdown",
0056     url="https://gitlab.com/mattbas/python-lottie/",
0057     package_dir={'': 'lib'},
0058     license="GNU Affero General Public License v3 or later (AGPLv3+)",
0059     packages=find_packages(),
0060     scripts=[
0061         os.path.join("bin", "raster_palette.py"),
0062         os.path.join("bin", "lottie_cat.py"),
0063         os.path.join("bin", "tgs_check.py"),
0064         os.path.join("bin", "lottie_convert.py"),
0065         os.path.join("bin", "lottie_diff.py"),
0066         os.path.join("bin", "lottie_fonts.py"),
0067         os.path.join("bin", "lottie_printcolor.py"),
0068         os.path.join("bin", "lottie_diagnostic.py"),
0069     ],
0070     keywords="telegram stickers tgs lottie svg animation",
0071     # https://pypi.org/classifiers/
0072     classifiers=[
0073         "Programming Language :: Python :: 3",
0074         "Development Status :: 4 - Beta",
0075         "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
0076         "Operating System :: OS Independent",
0077         "Topic :: Multimedia :: Graphics",
0078     ],
0079     zip_safe=True,
0080     python_requires=">=3",
0081     extras_require=extras_require,
0082     test_suite="test",
0083     project_urls={
0084         "Code": "https://gitlab.com/mattbas/python-lottie/",
0085         "Documentation": "https://mattbas.gitlab.io/python-lottie/index.html",
0086         "Chat": "https://t.me/tgs_stuff",
0087         "Coverage": "https://mattbas.gitlab.io/python-lottie/coverage/",
0088         "Downloads": "https://mattbas.gitlab.io/python-lottie/downloads.html",
0089     },
0090     data_files=[(".", [".version_full"])],
0091 )