Skip to content

Commit b8e0160

Browse files
authored
Merge pull request #453 from sass/setup-cfg-fmt
use setup-cfg-fmt to format package metadata
2 parents a5cb682 + 73d9fe0 commit b8e0160

File tree

3 files changed

+50
-70
lines changed

3 files changed

+50
-70
lines changed

.pre-commit-config.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ repos:
99
- id: double-quote-string-fixer
1010
- id: name-tests-test
1111
- id: requirements-txt-fixer
12+
- repo: https://github.com/asottile/setup-cfg-fmt
13+
rev: v2.5.0
14+
hooks:
15+
- id: setup-cfg-fmt
1216
- repo: https://github.com/asottile/reorder-python-imports
1317
rev: v3.12.0
1418
hooks:
@@ -28,7 +32,7 @@ repos:
2832
hooks:
2933
- id: autopep8
3034
- repo: https://github.com/PyCQA/flake8
31-
rev: 6.1.0
35+
rev: 7.0.0
3236
hooks:
3337
- id: flake8
3438
exclude: ^docs/conf.py

setup.cfg

+45-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,51 @@
1+
[metadata]
2+
name = libsass
3+
version = attr: sass.__version__
4+
description = Sass for Python: A straightforward binding of libsass for Python.
5+
long_description = file: README.rst
6+
long_description_content_type = text/x-rst
7+
url = https://sass.github.io/libsass-python/
8+
author = Hong Minhee
9+
author_email = minhee@dahlia.kr
10+
license = MIT
11+
license_files = LICENSE
12+
classifiers =
13+
Development Status :: 5 - Production/Stable
14+
Environment :: Web Environment
15+
Intended Audience :: Developers
16+
License :: OSI Approved :: MIT License
17+
Operating System :: OS Independent
18+
Programming Language :: C
19+
Programming Language :: C++
20+
Programming Language :: Python :: 3
21+
Programming Language :: Python :: 3 :: Only
22+
Programming Language :: Python :: Implementation :: CPython
23+
Programming Language :: Python :: Implementation :: PyPy
24+
Programming Language :: Python :: Implementation :: Stackless
25+
Topic :: Internet :: WWW/HTTP
26+
Topic :: Internet :: WWW/HTTP :: Dynamic Content
27+
Topic :: Software Development :: Code Generators
28+
Topic :: Software Development :: Compilers
29+
30+
[options]
31+
packages = sassutils
32+
py_modules =
33+
pysassc
34+
sass
35+
sasstests
36+
python_requires = >=3.8
37+
38+
[options.entry_points]
39+
console_scripts =
40+
pysassc = pysassc:main
41+
distutils.commands =
42+
build_sass = sassutils.distutils:build_sass
43+
distutils.setup_keywords =
44+
sass_manifests = sassutils.distutils:validate_manifests
45+
146
[aliases]
247
upload_doc = build_sphinx upload_doc
348
release = sdist upload build_sphinx upload_doc
449

550
[flake8]
651
exclude = .tox,build,dist,docs,ez_setup.py
7-
8-
[metadata]
9-
license_file = LICENSE

setup.py

-66
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import ast
21
import atexit
32
import os.path
43
import platform
@@ -169,24 +168,6 @@ def restore_cencode():
169168
)
170169

171170

172-
def version(sass_filename='sass.py'):
173-
with open(sass_filename) as f:
174-
tree = ast.parse(f.read(), sass_filename)
175-
for node in tree.body:
176-
if isinstance(node, ast.Assign) and len(node.targets) == 1:
177-
target, = node.targets
178-
if isinstance(target, ast.Name) and target.id == '__version__':
179-
return node.value.s
180-
181-
182-
def readme():
183-
try:
184-
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as f:
185-
return f.read()
186-
except OSError:
187-
pass
188-
189-
190171
class upload_doc(distutils.cmd.Command):
191172
"""Uploads the documentation to GitHub pages."""
192173

@@ -237,53 +218,6 @@ def finalize_options(self):
237218

238219

239220
setup(
240-
name='libsass',
241-
description='Sass for Python: '
242-
'A straightforward binding of libsass for Python.',
243-
long_description=readme(),
244-
version=version(),
245221
ext_modules=[sass_extension],
246-
packages=['sassutils'],
247-
py_modules=['pysassc', 'sass', 'sasstests'],
248-
package_data={
249-
'': [
250-
'README.rst',
251-
'test/*.sass',
252-
],
253-
},
254-
license='MIT License',
255-
author='Hong Minhee',
256-
author_email='minhee' '@' 'dahlia.kr',
257-
url='https://sass.github.io/libsass-python/',
258-
download_url='https://github.com/sass/libsass-python/releases',
259-
entry_points={
260-
'distutils.commands': [
261-
'build_sass = sassutils.distutils:build_sass',
262-
],
263-
'distutils.setup_keywords': [
264-
'sass_manifests = sassutils.distutils:validate_manifests',
265-
],
266-
'console_scripts': [
267-
['pysassc = pysassc:main'],
268-
],
269-
},
270-
classifiers=[
271-
'Development Status :: 5 - Production/Stable',
272-
'Environment :: Web Environment',
273-
'Intended Audience :: Developers',
274-
'License :: OSI Approved :: MIT License',
275-
'Operating System :: OS Independent',
276-
'Programming Language :: C',
277-
'Programming Language :: C++',
278-
'Programming Language :: Python :: 3',
279-
'Programming Language :: Python :: Implementation :: CPython',
280-
'Programming Language :: Python :: Implementation :: PyPy',
281-
'Programming Language :: Python :: Implementation :: Stackless',
282-
'Topic :: Internet :: WWW/HTTP',
283-
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
284-
'Topic :: Software Development :: Code Generators',
285-
'Topic :: Software Development :: Compilers',
286-
],
287-
python_requires='>=3.8',
288222
cmdclass=cmdclass,
289223
)

0 commit comments

Comments
 (0)