[python-django-admin-honeypot] python-django-admin-honeypot branch:devel
Eduardo Javier Echeverria Alvarado
echevemaster at fedoraproject.org
Tue Sep 11 13:52:54 UTC 2012
commit 1d95b26df76fde1c7964f206d9134dddcdd1e3ab
Author: Eduardo Echeverria <echevemaster at gmail.com>
Date: Tue Sep 11 09:09:58 2012 -0430
python-django-admin-honeypot branch:devel
0002-change-setup.py-requires-to-fix.patch | 372 ++++++++++++++++++++++++++++
python-django-admin-honeypot.spec | 72 ++++++
sources | 1 +
3 files changed, 445 insertions(+), 0 deletions(-)
---
diff --git a/0002-change-setup.py-requires-to-fix.patch b/0002-change-setup.py-requires-to-fix.patch
new file mode 100644
index 0000000..a33854c
--- /dev/null
+++ b/0002-change-setup.py-requires-to-fix.patch
@@ -0,0 +1,372 @@
+diff -uNr django-admin-honeypot-0.2.3-orig/setup.py django-admin-honeypot-0.2.3/setup.py
+--- django-admin-honeypot-0.2.3-orig/setup.py 2012-09-10 20:09:36.701501865 -0430
++++ django-admin-honeypot-0.2.3/setup.py 2012-09-10 20:31:48.071579022 -0430
+@@ -58,7 +58,7 @@
+ tests_require=(
+ 'coverage',
+ 'django',
+- 'pep8==1.3.1',
++ 'pep8==1.3.3',
+ ),
+ zip_safe=False,
+ )
+diff -uNr django-admin-honeypot-0.2.3-orig/tests/__init__.py django-admin-honeypot-0.2.3/tests/__init__.py
+--- django-admin-honeypot-0.2.3-orig/tests/__init__.py 1969-12-31 20:00:00.000000000 -0400
++++ django-admin-honeypot-0.2.3/tests/__init__.py 2012-09-10 20:13:01.074513715 -0430
+@@ -0,0 +1 @@
++#initialize test
+diff -uNr django-admin-honeypot-0.2.3-orig/tests/setuptest.py django-admin-honeypot-0.2.3/tests/setuptest.py
+--- django-admin-honeypot-0.2.3-orig/tests/setuptest.py 1969-12-31 20:00:00.000000000 -0400
++++ django-admin-honeypot-0.2.3/tests/setuptest.py 2012-09-10 20:10:47.714505978 -0430
+@@ -0,0 +1,169 @@
++import pep8
++import sys
++import unittest
++
++from coverage import coverage, misc
++from distutils import log
++from StringIO import StringIO
++
++
++class SetupTestSuite(unittest.TestSuite):
++ """
++ Test Suite configuring Django settings and using
++ DjangoTestSuiteRunner as test runner.
++ Also runs PEP8 and Coverage checks.
++ """
++ def __init__(self, *args, **kwargs):
++ self.configure()
++ self.cov = coverage()
++ self.cov.start()
++ self.packages = self.resolve_packages()
++
++ super(SetupTestSuite, self).__init__(tests=self.build_tests(), \
++ *args, **kwargs)
++
++ # Setup testrunner.
++ from django.test.simple import DjangoTestSuiteRunner
++ self.test_runner = DjangoTestSuiteRunner(
++ verbosity=1,
++ interactive=True,
++ failfast=False
++ )
++ self.test_runner.setup_test_environment()
++ self.old_config = self.test_runner.setup_databases()
++
++ def build_tests(self):
++ """
++ Build tests for inclusion in suite from resolved packages.
++ """
++ from django.core.exceptions import ImproperlyConfigured
++ from django.db.models import get_app
++ from django.test.simple import build_suite
++
++ tests = []
++ for package in self.packages:
++ try:
++ app_name = package.rsplit('.')[-1]
++ app = get_app(app_name, emptyOK=True)
++ tests.append(build_suite(app))
++ except ImproperlyConfigured, e:
++ raise
++ log.info("Warning: %s" % e)
++ except ImportError, e:
++ raise
++ log.info("Warning: %s" % e)
++ return tests
++
++ def configure(self):
++ """
++ Configures Django settings.
++ """
++ from django.conf import settings
++ from django.utils.importlib import import_module
++ try:
++ test_settings = import_module('tests.test_settings')
++ except ImportError, e:
++ log.info('ImportError: Unable to import test settings: %s' % e)
++ sys.exit(1)
++
++ setting_attrs = {}
++ for attr in dir(test_settings):
++ if '__' not in attr:
++ setting_attrs[attr] = getattr(test_settings, attr)
++
++ if not settings.configured:
++ settings.configure(**setting_attrs)
++
++ def coverage_report(self):
++ """
++ Outputs Coverage report to screen and coverage.xml.
++ """
++ verbose = '--quiet' not in sys.argv
++ self.cov.stop()
++ if verbose:
++ log.info("\nCoverage Report:")
++ try:
++ include = ['%s*' % package for package in self.packages]
++ omit = ['*tests*']
++ self.cov.report(include=include, omit=omit)
++ self.cov.xml_report(include=include, omit=omit)
++ except misc.CoverageException, e:
++ log.info("Coverage Exception: %s" % e)
++
++ def resolve_packages(self):
++ from django.conf import settings
++
++ packages = list()
++ targets = self.get_target_packages()
++
++ for app in settings.INSTALLED_APPS:
++ for target in targets:
++ if app.startswith(target):
++ packages.append(app)
++ return packages
++
++ def get_target_packages(self):
++ """
++ Frame hack to determine packages contained in module for testing.
++ We ignore submodules (those containing '.')
++ """
++ f = sys._getframe()
++ while f:
++ if 'self' in f.f_locals:
++ locals_self = f.f_locals['self']
++ py_modules = getattr(locals_self, 'py_modules', None)
++ packages = getattr(locals_self, 'packages', None)
++
++ top_packages = []
++ if py_modules or packages:
++ if py_modules:
++ for module in py_modules:
++ if '.' not in module:
++ top_packages.append(module)
++ if packages:
++ for package in packages:
++ if '.' not in package:
++ top_packages.append(package)
++
++ return list(set(top_packages))
++ f = f.f_back
++
++ def pep8_report(self):
++ """
++ Outputs PEP8 report to screen and pep8.txt.
++ """
++ verbose = '--quiet' not in sys.argv
++ if verbose:
++ # Hook into stdout.
++ old_stdout = sys.stdout
++ sys.stdout = mystdout = StringIO()
++
++ # Run Pep8 checks.
++ pep8_style = pep8.StyleGuide(ignore=['E2', 'E3', 'E4', 'E501', 'W'])
++ pep8_style.check_files([pkg.replace('.', '/') for pkg in self.packages])
++
++ # Restore stdout.
++ sys.stdout = old_stdout
++
++ # Save result to pep8.txt.
++ result = mystdout.getvalue()
++ output = open('pep8.txt', 'w')
++ output.write(result)
++ output.close()
++
++ # Return Pep8 result
++ if result:
++ log.info("\nPEP8 Report:")
++ log.info(result)
++
++ def run(self, *args, **kwargs):
++ """
++ Run the test, teardown the environment and generate reports.
++ """
++ result = super(SetupTestSuite, self).run(*args, **kwargs)
++ self.test_runner.teardown_databases(self.old_config)
++ self.test_runner.teardown_test_environment()
++ self.coverage_report()
++ self.pep8_report()
++ return result
++
+diff -uNr django-admin-honeypot-0.2.3-orig/tests/test_settings.py django-admin-honeypot-0.2.3/tests/test_settings.py
+--- django-admin-honeypot-0.2.3-orig/tests/test_settings.py 1969-12-31 20:00:00.000000000 -0400
++++ django-admin-honeypot-0.2.3/tests/test_settings.py 2012-09-10 20:10:47.714505978 -0430
+@@ -0,0 +1,156 @@
++# Django settings for {{ project_name }} project.
++import os
++
++PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
++DEBUG = True
++TEMPLATE_DEBUG = DEBUG
++
++ADMINS = (
++ ('Admin User', 'admin at example.com')
++)
++
++MANAGERS = ADMINS
++
++DATABASES = {
++ 'default': {
++ 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
++ 'NAME': ':memory:', # Or path to database file if using sqlite3.
++ 'USER': '', # Not used with sqlite3.
++ 'PASSWORD': '', # Not used with sqlite3.
++ 'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
++ 'PORT': '', # Set to empty string for default. Not used with sqlite3.
++ }
++}
++
++# Local time zone for this installation. Choices can be found here:
++# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
++# although not all choices may be available on all operating systems.
++# On Unix systems, a value of None will cause Django to use the same
++# timezone as the operating system.
++# If running in a Windows environment this must be set to the same as your
++# system time zone.
++TIME_ZONE = 'America/Chicago'
++
++# Language code for this installation. All choices can be found here:
++# http://www.i18nguy.com/unicode/language-identifiers.html
++LANGUAGE_CODE = 'en-us'
++
++SITE_ID = 1
++
++# If you set this to False, Django will make some optimizations so as not
++# to load the internationalization machinery.
++USE_I18N = True
++
++# If you set this to False, Django will not format dates, numbers and
++# calendars according to the current locale.
++USE_L10N = True
++
++# If you set this to False, Django will not use timezone-aware datetimes.
++USE_TZ = True
++
++# Absolute filesystem path to the directory that will hold user-uploaded files.
++# Example: "/home/media/media.lawrence.com/media/"
++MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
++
++# URL that handles the media served from MEDIA_ROOT. Make sure to use a
++# trailing slash.
++# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
++MEDIA_URL = '/media/'
++
++# Absolute path to the directory static files should be collected to.
++# Don't put anything in this directory yourself; store your static files
++# in apps' "static/" subdirectories and in STATICFILES_DIRS.
++# Example: "/home/media/media.lawrence.com/static/"
++STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
++
++# URL prefix for static files.
++# Example: "http://media.lawrence.com/static/"
++STATIC_URL = '/static/'
++
++# Additional locations of static files
++STATICFILES_DIRS = (
++ # Put strings here, like "/home/html/static" or "C:/www/django/static".
++ # Always use forward slashes, even on Windows.
++ # Don't forget to use absolute paths, not relative paths.
++)
++
++# List of finder classes that know how to find static files in
++# various locations.
++STATICFILES_FINDERS = (
++ 'django.contrib.staticfiles.finders.FileSystemFinder',
++ 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
++# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
++)
++
++# Make this unique, and don't share it with anybody.
++SECRET_KEY = 'uv(aokeqwo$jj&$p7bhh6qf^*idhqowmb(uh9*_j&3h96rq at ai'
++
++# List of callables that know how to import templates from various sources.
++TEMPLATE_LOADERS = (
++ 'django.template.loaders.filesystem.Loader',
++ 'django.template.loaders.app_directories.Loader',
++# 'django.template.loaders.eggs.Loader',
++)
++
++MIDDLEWARE_CLASSES = (
++ 'django.middleware.common.CommonMiddleware',
++ 'django.contrib.sessions.middleware.SessionMiddleware',
++ 'django.middleware.csrf.CsrfViewMiddleware',
++ 'django.contrib.auth.middleware.AuthenticationMiddleware',
++ 'django.contrib.messages.middleware.MessageMiddleware',
++ # Uncomment the next line for simple clickjacking protection:
++ # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
++)
++
++ROOT_URLCONF = 'tests.urls'
++
++TEMPLATE_DIRS = (
++ # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
++ # Always use forward slashes, even on Windows.
++ # Don't forget to use absolute paths, not relative paths.
++)
++
++INSTALLED_APPS = (
++ 'django.contrib.auth',
++ 'django.contrib.contenttypes',
++ 'django.contrib.sessions',
++ 'django.contrib.sites',
++ 'django.contrib.messages',
++ #'django.contrib.staticfiles',
++ 'admin_honeypot',
++ # Uncomment the next line to enable the admin:
++ 'django.contrib.admin',
++ # Uncomment the next line to enable admin documentation:
++ # 'django.contrib.admindocs',
++)
++
++# A sample logging configuration. The only tangible logging
++# performed by this configuration is to send an email to
++# the site admins on every HTTP 500 error when DEBUG=False.
++# See http://docs.djangoproject.com/en/dev/topics/logging for
++# more details on how to customize your logging configuration.
++LOGGING = {
++ 'version': 1,
++ 'disable_existing_loggers': False,
++ 'filters': {
++ 'require_debug_false': {
++ '()': 'django.utils.log.RequireDebugFalse'
++ }
++ },
++ 'handlers': {
++ 'mail_admins': {
++ 'level': 'ERROR',
++ 'filters': ['require_debug_false'],
++ 'class': 'django.utils.log.AdminEmailHandler'
++ }
++ },
++ 'loggers': {
++ 'django.request': {
++ 'handlers': ['mail_admins'],
++ 'level': 'ERROR',
++ 'propagate': True,
++ },
++ }
++}
++
++ADMIN_HONEYPOT_EMAIL_ADMINS = True
+diff -uNr django-admin-honeypot-0.2.3-orig/tests/urls.py django-admin-honeypot-0.2.3/tests/urls.py
+--- django-admin-honeypot-0.2.3-orig/tests/urls.py 1969-12-31 20:00:00.000000000 -0400
++++ django-admin-honeypot-0.2.3/tests/urls.py 2012-09-10 20:10:47.720505979 -0430
+@@ -0,0 +1,18 @@
++from django.conf.urls.defaults import patterns, include, url
++
++# Uncomment the next two lines to enable the admin:
++from django.contrib import admin
++admin.autodiscover()
++
++urlpatterns = patterns('',
++ # Examples:
++ # url(r'^$', '{{ project_name }}.views.home', name='home'),
++ # url(r'^{{ project_name }}/', include('playground.foo.urls')),
++
++ # Uncomment the admin/doc line below to enable admin documentation:
++ # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
++
++ # Uncomment the next line to enable the admin:
++ url(r'^admin/', include('admin_honeypot.urls')),
++ url(r'^secret/', include(admin.site.urls)),
++)
diff --git a/python-django-admin-honeypot.spec b/python-django-admin-honeypot.spec
new file mode 100644
index 0000000..f945204
--- /dev/null
+++ b/python-django-admin-honeypot.spec
@@ -0,0 +1,72 @@
+%global pkgname django-admin-honeypot
+Name: python-django-admin-honeypot
+Version: 0.2.3
+Release: 5%{?dist}
+Summary: A fake Django admin log in screen to notify admins of unauthorized access
+
+Group: Development/Languages
+License: MIT
+URL: https://github.com/dmpayton/django-admin-honeypot
+Source0: http://pypi.python.org/packages/source/d/%{pkgname}/%{pkgname}-%{version}.tar.gz
+Patch1: 0002-change-setup.py-requires-to-fix.patch
+BuildArch: noarch
+BuildRequires: python2-devel
+BuildRequires: python-setuptools
+BuildRequires: python-coverage
+BuildRequires: python-pep8 >= 1.3.3
+
+%if 0%{?fedora} >= 18
+Requires: python-django
+BuildRequires: python-django
+%else
+Requires: Django
+BuildRequires: Django
+%endif
+
+
+
+Provides: %{pkgname} = %{version}-%{release}
+
+%description
+A fake admin log in screen to notify admins of attempted unauthorized access.
+
+%prep
+%setup -q -n %{pkgname}-%{version}
+%patch1 -p1
+
+
+%build
+python setup.py build
+
+%check
+%{__python} setup.py test
+
+%install
+python setup.py install --skip-build --root $RPM_BUILD_ROOT
+
+
+%files
+%doc PKG-INFO LICENSE README.mkd
+%{python_sitelib}/admin_honeypot
+%{python_sitelib}/django_admin_honeypot-*.egg-info
+
+%changelog
+* Mon Sep 10 2012 Eduardo Echeverria <echevemaster at gmail.com> - 0.2.3-5
+- Add python-pep8 >= 1.3.3 during build (Available in rawhide)
+- Add a patch for test suite
+
+* Thu Sep 06 2012 Eduardo Echeverria <echevemaster at gmail.com> - 0.2.3-4
+- Add python-django during build
+- Add python-pep8 >= 1.3 during build
+- Add python-coverage during build
+- Add check section
+- Add patch for test (change version pep8 1.3.3 at 1.3)
+
+* Wed Sep 05 2012 Eduardo Echeverria <echevemaster at gmail.com> - 0.2.3-3
+- Remove python-django during build
+
+* Tue Sep 04 2012 Eduardo Echeverria <echevemaster at gmail.com> - 0.2.3-2
+- Change Summary
+
+* Tue Sep 04 2012 Eduardo Echeverria <echevemaster at gmail.com> - 0.2.3-1
+- initial packaging
diff --git a/sources b/sources
index e69de29..fd6a4fe 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+b1d50eac4adabf5d8db8d503e1671d3a django-admin-honeypot-0.2.3.tar.gz
More information about the scm-commits
mailing list