Skip to content
Browse files

prep to make a real package

  • Loading branch information...
1 parent c528041 commit ecce119fbc931b38bf1137234fbc392e5432fcbf @jbergantine committed Nov 24, 2012
Showing with 211 additions and 31 deletions.
  1. +19 −0 LICENSE.txt
  2. +82 −0 README.rst
  3. +9 −0 events/__init__.py
  4. +3 −0 manifest.in
  5. +0 −27 readme.md
  6. +0 −4 requirements.txt
  7. +98 −0 setup.py
View
19 LICENSE.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Joe Bergantine
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
82 README.rst
@@ -0,0 +1,82 @@
+=============
+Django Events
+=============
+
+Installation from Source
+========================
+
+::
+
+ $ git clone git://github.com/jbergantine/django-events.git
+ $ cd django-events
+ $ python setup.py install
+
+You will also have to install `South <http://pypi.python.org/pypi/South/>`_, `Markdown <http://pypi.python.org/pypi/Markdown/>`_ and `sorl-thumbnail <http://pypi.python.org/pypi/sorl-thumbnail/>`_.
+
+Installation via PIP Requirements File
+======================================
+
+Include in the PIP requirements file the following lines:
+
+::
+
+ markdown==2.2.1
+ sorl-thumbnail=3.2.5
+ south==0.7.6
+ -e git://github.com/jbergantine/django-blog.git#egg=django_blog
+
+And then install as normal (IE:)
+
+::
+
+ $ pip install -r path/to/requirements/file.txt
+
+Setup the Project For the Application
+=====================================
+
+Add to the project's settings file tuple of INSTALLED_APPS:
+
+::
+
+ 'events',
+ 'markdown',
+ 'sorl.thumbnail',
+ 'south'
+
+Sync the database to finish installing sorl-thumbnail.
+
+::
+
+ $ python manage.py syncdb
+
+Migrate the database to finish installing events.
+
+::
+
+ $ python manage.py migrate
+
+
+In the project's urls.py file add:
+
+::
+
+ url(r'^events/', include('events.urls')),
+
+A list of upcoming events can now be linked to:
+
+::
+
+ <a href="{% url events %}">Events</a>
+
+The RSS feed of upcoming events can now be referred to in the ``<head>`` of your HTML templates:
+
+::
+
+ <link rel="feed alternate" type="application/rss+xml" title="Events" href="{% url events_feed %}" />
+
+Configure the Templates
+=======================
+
+By default the templates contain only the bare necessities. To override the default templates, create a directory called events in your templates directory and copy the templates from the project into that directory in order to make adjustments to them. If you're using Virtualenv, ``cd`` to the root of the django project and execute the following command: ::
+
+ cp -r $VIRTUAL_ENV/src/django-events/events/templates/events templates/events
View
9 events/__init__.py
@@ -0,0 +1,9 @@
+VERSION = (1, 0, 0)
+
+# Dynamically calculate the version based on VERSION tuple
+if len(VERSION) > 2 and VERSION[2] is not None:
+ str_version = "%s.%s_%s" % VERSION[:3]
+else:
+ str_version = "%s.%s" % VERSION[:2]
+
+__version__ = str_version
View
3 manifest.in
@@ -0,0 +1,3 @@
+recursive-include events/templates *.html
+include LICENSE.txt
+include README.rst
View
27 readme.md
@@ -1,27 +0,0 @@
-## Installation
-
- $ pip install -r requirements.txt
-
-## Usage
-
-Add ``'events',`` to the ``INSTALLED_APPS`` tuple in ``settings.py``.
-
-Add ``'sorl.thumbnail',`` to the ``INSTALLED_APPS`` tuple in ``settings.py``.
-
-Sync the database to finish installing sorl-thumbnail.
-
-Migrate the database to finish installing events.
-
-Add the following to the ``patterns()`` method in the project's primary ``urls.py`` file:
-
- url(r'^events/', include('events.urls')),
-
-A list of upcoming events can now be linked to:
-
- <a href="{% url events %}">Events</a>
-
-The RSS feed of upcoming events can now be referred to in the ``<head>`` of your HTML templates:
-
- <link rel="feed alternate" type="application/rss+xml" title="Events" href="{% url events_feed %}" />
-
-Edit the templates as necessary.
View
4 requirements.txt
@@ -1,4 +0,0 @@
-#django
-markdown
-sorl-thumbnail
-south
View
98 setup.py
@@ -0,0 +1,98 @@
+"""
+Based entirely on Django's own ``setup.py``.
+"""
+import os
+import sys
+from distutils.command.install_data import install_data
+from distutils.command.install import INSTALL_SCHEMES
+from distutils.core import setup
+
+
+class osx_install_data(install_data):
+ # On MacOS, the platform-specific lib dir is at:
+ # /System/Library/Framework/Python/.../
+ # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific
+ # fix for this in distutils.command.install_data#306. It fixes install_lib
+ # but not install_data, which is why we roll our own install_data class.
+
+ def finalize_options(self):
+ # By the time finalize_options is called, install.install_lib is set to
+ # the fixed directory, so we set the installdir to install_lib. The
+ # install_data class uses ('install_data', 'install_dir') instead.
+ self.set_undefined_options('install', ('install_lib', 'install_dir'))
+ install_data.finalize_options(self)
+
+if sys.platform == "darwin":
+ cmdclasses = {'install_data': osx_install_data}
+else:
+ cmdclasses = {'install_data': install_data}
+
+
+def fullsplit(path, result=None):
+ """
+ Split a pathname into components (the opposite of os.path.join) in a
+ platform-neutral way.
+ """
+ if result is None:
+ result = []
+ head, tail = os.path.split(path)
+ if head == '':
+ return [tail] + result
+ if head == path:
+ return result
+ return fullsplit(head, [tail] + result)
+
+# Tell distutils to put the data_files in platform-specific installation
+# locations. See here for an explanation:
+# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
+for scheme in INSTALL_SCHEMES.values():
+ scheme['data'] = scheme['purelib']
+
+# Compile the list of packages available, because distutils doesn't have
+# an easy way to do this.
+packages, data_files = [], []
+root_dir = os.path.dirname(__file__)
+if root_dir != '':
+ os.chdir(root_dir)
+extensions_dir = 'events'
+
+for dirpath, dirnames, filenames in os.walk(extensions_dir):
+ # Ignore dirnames that start with '.'
+ for i, dirname in enumerate(dirnames):
+ if dirname.startswith('.'):
+ del dirnames[i]
+ if '__init__.py' in filenames:
+ packages.append('.'.join(fullsplit(dirpath)))
+ elif filenames:
+ data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
+
+version = __import__('events').__version__
+
+setup(
+ name='django-events',
+ version=version,
+ description="Simple Events Calendar for Django",
+ long_description="""django-events creates a simple events calendar application
+for Django projects. See the project page for more information:
+ https://github.com/jbergantine/django-events""",
+ author='Joe Bergantine',
+ author_email='jbergantine@gmail.com',
+ maintainer='Joe Bergantine',
+ maintainer_email='jbergantine@gmail.com',
+ url='https://github.com/jbergantine/django-events',
+ license='New BSD License',
+ platforms=['any'],
+ packages=packages,
+ cmdclass=cmdclasses,
+ data_files=data_files,
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Framework :: Django',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: BSD License',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Utilities',
+ ],
+)

0 comments on commit ecce119

Please sign in to comment.
Something went wrong with that request. Please try again.