Commits

Andriy Kornatskyy committed 6904759

Fixed compatibility issue with python2.4; excluded python3.2 from tests due to PIL is not yet ready.

  • Participants
  • Parent commits f7c4b58

Comments (0)

Files changed (3)

 	# http://mindref.blogspot.com/2011/09/compile-python-from-source.html
 	apt-get -y install libbz2-dev build-essential python \
 		python-dev python-setuptools python-virtualenv \
-		python-sphinx
+		python-sphinx libfreetype6-dev libjpeg8-dev
 
 env:
-	PYTHON_EXE=/usr/local/bin/python$(VERSION); \
-	if [ ! -x $$PYTHON_EXE ]; then \
-		PYTHON_EXE=/usr/bin/python$(VERSION); \
-	fi;\
-	VIRTUALENV_USE_SETUPTOOLS=1; \
-	export VIRTUALENV_USE_SETUPTOOLS; \
-	virtualenv --python=$$PYTHON_EXE \
-		--no-site-packages env
-	if [ "$$(echo $(VERSION) | sed 's/\.//')" -ge 30 ]; then \
-		echo -n 'Upgrading distribute...'; \
-		$(EASY_INSTALL) -i $(PYPI) -U -O2 distribute \
-			> /dev/null 2>/dev/null; \
-		echo 'done.'; \
-	fi
-	$(EASY_INSTALL) -i $(PYPI) -O2 coverage nose pytest \
-		pytest-pep8 pytest-cov libfreetype6-dev libjpeg8-dev
 	# The following packages available for python < 3.0
-	#if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
-	#fi;
-	$(PYTHON) setup.py develop -i $(PYPI)
+	if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
+		PYTHON_EXE=/usr/local/bin/python$(VERSION); \
+		if [ ! -x $$PYTHON_EXE ]; then \
+			PYTHON_EXE=/usr/bin/python$(VERSION); \
+		fi;\
+		VIRTUALENV_USE_SETUPTOOLS=1; \
+		export VIRTUALENV_USE_SETUPTOOLS; \
+		virtualenv --python=$$PYTHON_EXE \
+			--no-site-packages env; \
+		if [ "$$(echo $(VERSION) | sed 's/\.//')" -ge 30 ]; then \
+			echo -n 'Upgrading distribute...'; \
+			$(EASY_INSTALL) -i $(PYPI) -U -O2 distribute \
+				> /dev/null 2>/dev/null; \
+			echo 'done.'; \
+		fi; \
+		$(EASY_INSTALL) -i $(PYPI) -O2 coverage nose pytest \
+			pytest-pep8 pytest-cov wheezy.caching wheezy.http; \
+		$(PYTHON) setup.py develop -i $(PYPI); \
+	fi;
 
 clean:
 	find src/ -type d -name __pycache__ | xargs rm -rf
 	rm -rf dist/ build/ MANIFEST src/*.egg-info .cache .coverage
 
 release:
-	$(PYTHON) setup.py -q bdist_egg
+	if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
+		$(PYTHON) setup.py -q bdist_egg; \
+	fi
 
 upload:
 	REV=$$(hg head --template '{rev}');\
 			-a -b html doc/ doc/_build/;\
 		python setup.py upload_docs; \
 	fi; \
-	$(PYTHON) setup.py -q egg_info --tag-build .$$REV \
-		bdist_egg --dist-dir=$(DIST_DIR) \
-		rotate --match=$(VERSION).egg --keep=1 --dist-dir=$(DIST_DIR) \
-		upload;
+	if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
+		$(PYTHON) setup.py -q egg_info --tag-build .$$REV \
+			bdist_egg --dist-dir=$(DIST_DIR) \
+			rotate --match=$(VERSION).egg --keep=1 --dist-dir=$(DIST_DIR) \
+			upload; \
+	fi
 
 test:
-	$(PYTEST) -q -x --pep8 --doctest-modules \
-		src/wheezy/captcha demos/
+	# The can be run for python < 3.0
+	if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
+		$(PYTEST) -q -x --pep8 --doctest-modules \
+			src/wheezy/captcha demos/; \
+	fi
 
 doctest-cover:
-	$(NOSE) --stop --with-doctest --detailed-errors \
-		--with-coverage --cover-package=wheezy.captcha
+	# The can be run for python < 3.0
+	if [ "$$(echo $(VERSION) | sed 's/\.//')" -lt 30 ]; then \
+		$(NOSE) --stop --with-doctest --detailed-errors \
+			--with-coverage --cover-package=wheezy.captcha; \
+	fi
 
 test-cover:
 	$(PYTEST) -q --cov wheezy.caching \
 
 README = open(os.path.join(os.path.dirname(__file__), 'README')).read()
 
+install_requires = [
+    'PIL>=1.1.7'
+]
+
+try:
+    import uuid
+except:
+    install_requires.append('uuid')
+
 setup(
     name='wheezy.captcha',
     version='0.1',
         'Programming Language :: Python :: 2.5',
         'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3',
-        'Programming Language :: Python :: 3.2',
+        #'Programming Language :: Python :: 3',
+        #'Programming Language :: Python :: 3.2',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Internet :: WWW/HTTP',
     namespace_packages=['wheezy'],
 
     zip_safe=False,
-    install_requires=[
-        'PIL>=1.1.7'
-    ],
+    install_requires=install_requires,
     extras_require={
         'dev': [
             'coverage',
             'nose',
             'pytest',
             'pytest-pep8',
-            'pytest-cov'
-        ]
+            'pytest-cov',
+            'wheezy.caching',
+            'wheezy.http'
+        ],
     },
 
     platforms='any'

src/wheezy/captcha/http.py

 from wheezy.http import response_cache
 
 
-class FileAdapter():
+class FileAdapter(object):
 
     def __init__(self, response):
         self.response = response