| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| from __future__ import absolute_import |
| from __future__ import print_function |
| from distutils.command.build import build as _build |
| import io |
| import os.path |
| import subprocess |
| import sys |
|
|
|
|
| def setupdir(f): |
| ''' Decorate f to run inside the directory where setup.py resides. |
| ''' |
| setup_dir = os.path.dirname(os.path.abspath(__file__)) |
|
|
| def wrapped(*args, **kwargs): |
| old_dir = os.path.abspath(os.curdir) |
| try: |
| os.chdir(setup_dir) |
| return f(*args, **kwargs) |
| finally: |
| os.chdir(old_dir) |
|
|
| return wrapped |
|
|
|
|
| @setupdir |
| def import_setuptools(): |
| import setuptools |
| return setuptools |
|
|
|
|
| @setupdir |
| def readfile(filename): |
| with io.open(filename, 'r', encoding='utf-8') as f: |
| return f.read() |
|
|
|
|
| def get_version(): |
| version = readfile('VERSION.txt') |
| version = version.strip() |
| return version |
|
|
|
|
| def get_long_description(): |
| long_description = readfile('README') + '\n' + readfile('CHANGES') |
| return long_description |
|
|
|
|
| def get_classifiers(): |
| return [ |
| 'Development Status :: 4 - Beta', |
| 'Intended Audience :: Developers', |
| 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', |
| 'Programming Language :: Python :: 3', |
| 'Programming Language :: Python :: 3.11', |
| 'Topic :: Software Development :: Libraries :: Python Modules', |
| 'Topic :: Text Processing', |
| ] |
|
|
|
|
| def get_install_requires(): |
| requires = readfile('requirements.in') |
| requires = requires.strip() |
| requires = requires.split('\n') |
| requires = list(requires) |
| return requires |
|
|
|
|
| class build(_build): |
| def run(self): |
| |
| |
| |
| domains = [ |
| 'hwp5proc', |
| 'hwp5html', |
| 'hwp5odt', |
| 'hwp5txt', |
| 'hwp5view', |
| ] |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| _build.run(self) |
|
|
|
|
| setup_info = { |
|
|
| |
|
|
| 'name': 'pyhwp2', |
| 'version': get_version(), |
| 'description': 'hwp file format parser', |
| 'long_description': get_long_description(), |
|
|
| |
|
|
| 'author': 'mete0r', |
| 'author_email': '137794+mete0r@users.noreply.github.com', |
| 'license': 'GNU Affero General Public License v3 or later (AGPLv3+)', |
| 'url': 'https://github.com/mete0r/pyhwp', |
|
|
| |
|
|
| 'classifiers': get_classifiers(), |
|
|
| 'keywords': 'hwp', |
|
|
| |
|
|
| 'setup_requires': [ |
| 'babel', |
| ], |
|
|
| 'packages': [ |
| 'hwp5', |
| 'hwp5.binmodel', |
| 'hwp5.binmodel.controls', |
| 'hwp5.plat', |
| 'hwp5.plat._uno', |
| 'hwp5.proc', |
| 'hwp5.storage', |
| 'hwp5.transforms', |
| 'pyhwp', |
| ], |
| |
| 'package_dir': { |
| '': 'src', |
| }, |
|
|
| 'package_data': { |
| 'hwp5': [ |
| 'README', |
| 'COPYING', |
| 'VERSION.txt', |
| 'xsl/*.xsl', |
| 'xsl/odt/*.xsl', |
| 'odf-relaxng/OpenDocument-v1.2-os-*.rng', |
| 'locale/*/*/*.mo', |
| ], |
| }, |
|
|
| 'python_requires': '>=3.6', |
|
|
| |
|
|
| 'zip_safe': False, |
|
|
| 'entry_points': { |
| 'console_scripts': [ |
| 'hwp2html=pyhwp.html_converter:main', |
| 'hwp5spec=hwp5.binspec:main', |
| 'hwp5proc=hwp5.hwp5proc:main', |
| 'hwp5odt=hwp5.hwp5odt:main', |
| 'hwp5txt=hwp5.hwp5txt:main', |
| 'hwp5html=hwp5.hwp5html:main', |
| 'hwp5view=hwp5.hwp5view:main', |
| ] |
| }, |
|
|
| 'install_requires': get_install_requires(), |
| } |
|
|
|
|
| @setupdir |
| def main(): |
| setuptools = import_setuptools() |
| setup_info['cmdclass'] = { |
| 'build': build, |
| } |
| setuptools.setup(**setup_info) |
|
|
|
|
| if __name__ == '__main__': |
| main() |
|
|