diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 791adf5f..b92620c9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,10 @@ repos: - id: double-quote-string-fixer - id: name-tests-test - id: requirements-txt-fixer +- repo: https://github.com/asottile/setup-cfg-fmt + rev: v2.5.0 + hooks: + - id: setup-cfg-fmt - repo: https://github.com/asottile/reorder-python-imports rev: v3.12.0 hooks: @@ -28,7 +32,7 @@ repos: hooks: - id: autopep8 - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 exclude: ^docs/conf.py diff --git a/setup.cfg b/setup.cfg index 8d0ca2bb..86a67018 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,9 +1,51 @@ +[metadata] +name = libsass +version = attr: sass.__version__ +description = Sass for Python: A straightforward binding of libsass for Python. +long_description = file: README.rst +long_description_content_type = text/x-rst +url = https://sass.github.io/libsass-python/ +author = Hong Minhee +author_email = minhee@dahlia.kr +license = MIT +license_files = LICENSE +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Web Environment + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Programming Language :: C + Programming Language :: C++ + Programming Language :: Python :: 3 + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Programming Language :: Python :: Implementation :: Stackless + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: Dynamic Content + Topic :: Software Development :: Code Generators + Topic :: Software Development :: Compilers + +[options] +packages = sassutils +py_modules = + pysassc + sass + sasstests +python_requires = >=3.8 + +[options.entry_points] +console_scripts = + pysassc = pysassc:main +distutils.commands = + build_sass = sassutils.distutils:build_sass +distutils.setup_keywords = + sass_manifests = sassutils.distutils:validate_manifests + [aliases] upload_doc = build_sphinx upload_doc release = sdist upload build_sphinx upload_doc [flake8] exclude = .tox,build,dist,docs,ez_setup.py - -[metadata] -license_file = LICENSE diff --git a/setup.py b/setup.py index fe9743e8..b78fa05f 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -import ast import atexit import os.path import platform @@ -169,24 +168,6 @@ def restore_cencode(): ) -def version(sass_filename='sass.py'): - with open(sass_filename) as f: - tree = ast.parse(f.read(), sass_filename) - for node in tree.body: - if isinstance(node, ast.Assign) and len(node.targets) == 1: - target, = node.targets - if isinstance(target, ast.Name) and target.id == '__version__': - return node.value.s - - -def readme(): - try: - with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f: - return f.read() - except OSError: - pass - - class upload_doc(distutils.cmd.Command): """Uploads the documentation to GitHub pages.""" @@ -237,53 +218,6 @@ def finalize_options(self): setup( - name='libsass', - description='Sass for Python: ' - 'A straightforward binding of libsass for Python.', - long_description=readme(), - version=version(), ext_modules=[sass_extension], - packages=['sassutils'], - py_modules=['pysassc', 'sass', 'sasstests'], - package_data={ - '': [ - 'README.rst', - 'test/*.sass', - ], - }, - license='MIT License', - author='Hong Minhee', - author_email='minhee' '@' 'dahlia.kr', - url='https://sass.github.io/libsass-python/', - download_url='https://github.com/sass/libsass-python/releases', - entry_points={ - 'distutils.commands': [ - 'build_sass = sassutils.distutils:build_sass', - ], - 'distutils.setup_keywords': [ - 'sass_manifests = sassutils.distutils:validate_manifests', - ], - 'console_scripts': [ - ['pysassc = pysassc:main'], - ], - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: C', - 'Programming Language :: C++', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - 'Programming Language :: Python :: Implementation :: Stackless', - 'Topic :: Internet :: WWW/HTTP', - 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', - 'Topic :: Software Development :: Code Generators', - 'Topic :: Software Development :: Compilers', - ], - python_requires='>=3.8', cmdclass=cmdclass, )