[Python-modules-commits] [flask-htmlmin] 01/04: Begin packaging
Adrian Vondendriesch
discostu-guest at moszumanska.debian.org
Wed May 10 13:44:59 UTC 2017
This is an automated email from the git hooks/post-receive script.
discostu-guest pushed a commit to branch master
in repository flask-htmlmin.
commit 74ea4facd145a0769a560ba483cbb34dbaa7e52e
Author: Adrian Vondendriesch <adrian.vondendriesch at credativ.de>
Date: Mon Apr 3 17:41:19 2017 +0200
Begin packaging
---
.gitignore | 3 +++
.pc/.quilt_patches | 1 +
.pc/.quilt_series | 1 +
.pc/.version | 1 +
.pc/applied-patches | 0
LICENSE | 24 ++++++++++++++++++++++++
README.md | 39 +++++++++++++++++++++++++++++++++++++++
debian/changelog | 5 +++++
debian/compat | 1 +
debian/control | 19 +++++++++++++++++++
debian/rules | 8 ++++++++
debian/source/format | 1 +
debian/watch | 4 ++++
flask_htmlmin.py | 31 +++++++++++++++++++++++++++++++
setup.py | 40 ++++++++++++++++++++++++++++++++++++++++
15 files changed, 178 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bcee5c2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.idea/
+env/
+.DS_Store
diff --git a/.pc/.quilt_patches b/.pc/.quilt_patches
new file mode 100644
index 0000000..6857a8d
--- /dev/null
+++ b/.pc/.quilt_patches
@@ -0,0 +1 @@
+debian/patches
diff --git a/.pc/.quilt_series b/.pc/.quilt_series
new file mode 100644
index 0000000..c206706
--- /dev/null
+++ b/.pc/.quilt_series
@@ -0,0 +1 @@
+series
diff --git a/.pc/.version b/.pc/.version
new file mode 100644
index 0000000..0cfbf08
--- /dev/null
+++ b/.pc/.version
@@ -0,0 +1 @@
+2
diff --git a/.pc/applied-patches b/.pc/applied-patches
new file mode 100644
index 0000000..e69de29
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d956996
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2015, Hamid Feizabadi
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Hamid Feizabadi nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Hamid Feizabadi BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4bd103b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+Flask-HTMLmin
+=============
+
+Minify flask `text/html` mime types responses.
+Just add `MINIFY_PAGE = True` to your deployment config to minify html and text responses of your flask application.
+
+
+Installation
+------------
+To install Flask-HTMLmin, simply:
+
+ pip install Flask-HTMLmin
+
+Or alternatively, you can download the repository and install manually by doing:
+
+ git clone git at github.com:hamidfzm/Flask-HTMLmin.git
+ cd Flask-HTMLmin
+ python setup.py install
+
+
+Example
+-------
+
+ from flask import Flask, render_template
+ from flask.ext.htmlmin import HTMLMIN
+
+ app = Flask(__name__)
+ app.config['MINIFY_PAGE'] = True
+
+ HTMLMIN(app)
+ # or you can use HTMLMIN.init_app(app)
+
+ @app.route('/')
+ def main():
+ # index.html will be minimized !!!
+ return render_template('index.html')
+
+ if __name__ == '__main__':
+ app.run()
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..c4ee399
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+flask-htmlmin (1.2-1) unstable; urgency=low
+
+ * source package automatically created by stdeb 0.8.5
+
+ -- Adrian Vondendriesch <adrian.vondendriesch at credativ.de> Mon, 03 Apr 2017 17:39:54 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..adfcde2
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,19 @@
+Source: flask-htmlmin
+Maintainer: Adrian Vondendriesch <adrian.vondendriesch at credativ.de>
+Section: python
+Priority: optional
+Build-Depends: dh-python, python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 9)
+Standards-Version: 3.9.6
+Homepage: https://github.com/hamidfzm/Flask-HTMLmin
+
+Package: python-flask-htmlmin
+Architecture: all
+Depends: ${misc:Depends}, ${python:Depends}
+Description: Minimize render templates html
+ .
+ Flask-HTMLmin
+ -------------
+ .
+ minimize your flask rendered html
+ .
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..4751d92
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,8 @@
+#!/usr/bin/make -f
+
+# This file was automatically generated by stdeb 0.8.5 at
+# Mon, 03 Apr 2017 17:39:54 +0200
+export PYBUILD_NAME=flask-htmlmin
+%:
+ dh $@ --with python2 --buildsystem=pybuild
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..b5f914d
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+# please also check http://pypi.debian.net/Flask-HTMLmin/watch
+version=3
+opts=uversionmangle=s/(rc|a|b|c)/~$1/ \
+http://pypi.debian.net/Flask-HTMLmin/Flask-HTMLmin-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz)))
\ No newline at end of file
diff --git a/flask_htmlmin.py b/flask_htmlmin.py
new file mode 100644
index 0000000..e6b7edf
--- /dev/null
+++ b/flask_htmlmin.py
@@ -0,0 +1,31 @@
+from htmlmin.main import minify
+
+__author__ = 'Hamid FzM'
+
+
+class HTMLMIN(object):
+ def __init__(self, app=None):
+ self.app = app
+ if app is not None:
+ self.init_app(app)
+
+ def init_app(self, app):
+ app.config.setdefault('MINIFY_PAGE', False)
+
+ if app.config['MINIFY_PAGE']:
+ app.after_request(self.response_minify)
+
+ @staticmethod
+ def response_minify(response):
+ """
+ minify response html to decrease traffic
+ """
+ if response.content_type == u'text/html; charset=utf-8':
+ response.direct_passthrough = False
+ response.set_data(
+ minify(response.get_data(as_text=True),
+ remove_comments=True, reduce_empty_attributes=True, remove_optional_attribute_quotes=False)
+ )
+
+ return response
+ return response
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..238887d
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,40 @@
+
+"""
+Flask-HTMLmin
+-------------
+
+minimize your flask rendered html
+"""
+
+from setuptools import setup
+
+setup(
+ name='Flask-HTMLmin',
+ version='1.2',
+ url='https://github.com/hamidfzm/Flask-HTMLmin',
+ license='BSD',
+ author='Hamid FzM',
+ author_email='hamidfzm at gmail.com',
+ description='Minimize render templates html',
+ long_description=__doc__,
+ py_modules=['flask_htmlmin'],
+ zip_safe=False,
+ include_package_data=True,
+ platforms='any',
+ install_requires=[
+ 'Flask',
+ 'htmlmin'
+ ],
+ classifiers=[
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.2',
+ 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ 'Topic :: Text Processing :: Markup :: HTML',
+ ]
+)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/flask-htmlmin.git
More information about the Python-modules-commits
mailing list