diff --git a/.gitignore b/.gitignore index 67e31cf4..68fd65dc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ gh-pages gh *.pyc +python/*/__pycache__ python/MANIFEST python/build python/dist diff --git a/README.md b/README.md index 5255eab9..84618eb4 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,11 @@ To install the Python version of the beautifier: ```bash $ pip install jsbeautifier ``` -Unlike the JavaScript version, the Python version can only reformat JavaScript. It does not work against HTML or CSS files. +Unlike the JavaScript version, the Python version can only reformat JavaScript. It does not work against HTML or CSS files, but you can install _css-beautify_ for CSS (installs _jsbeautifier_ automatically) + +```bash +$ pip install cssbeautifier +``` # Usage You can beautify javascript using JS Beautifier in your web browser, or on the command-line using node.js or python. diff --git a/python/setup-css.py b/python/setup-css.py new file mode 100755 index 00000000..f50db610 --- /dev/null +++ b/python/setup-css.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import os +import sys + +from setuptools import setup +from jsbeautifier.__version__ import __version__ + +from setuptools.command.test import test as TestCommand + +DIR = 'cssbeautifier/tests/' + + +class PyTest(TestCommand): + user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] + + def initialize_options(self): + TestCommand.initialize_options(self) + self.pytest_args = ['--assert=plain'] + [DIR + \ + x for x in os.listdir(DIR) if x.endswith('.py') and x[0] not in '._'] + + def run_tests(self): + # import here, cause outside the eggs aren't loaded + import pytest + errno = pytest.main(self.pytest_args) + sys.exit(errno) + + +setup(name='cssbeautifier', + version=__version__, + description='CSS unobfuscator and beautifier.', + long_description=('Beautify, unpack or deobfuscate CSS'), + author='Liam Newman, Einar Lielmanis, et al.', + author_email='team@beautifier.io', + url='https://beautifier.io', + entry_points={ + 'console_scripts': [ + 'css-beautify = cssbeautifier:main' + ] + }, + packages=['cssbeautifier', + 'cssbeautifier.tests', 'cssbeautifier.tests.generated', + 'cssbeautifier.css'], + install_requires=["jsbeautifier>=__version__", "six>=1.13.0", "editorconfig>=0.12.2"], + license='MIT', + test_suite='pytest.collector', + cmdclass={'test': PyTest}, + + )