Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 50c7a29766
Fetching contributors…

Cannot retrieve contributors at this time

90 lines (79 sloc) 2.789 kB
import shutil, os, re
from setuptools import setup, find_packages
app_name = 'newsroom_pages'
def get_svn_revision(path=None):
rev = None
entries_path = '%s/.svn/entries' % path
if os.path.exists(entries_path):
entries = open(entries_path, 'r').read()
# Versions >= 7 of the entries file are flat text. The first line is
# the version number. The next set of digits after 'dir' is the revision.
if re.match('(\d+)', entries):
rev_match = re.search('\d+\s+dir\s+(\d+)', entries)
if rev_match:
rev = rev_match.groups()[0]
# Older XML versions of the file specify revision as an attribute of
# the first entries node.
else:
from xml.dom import minidom
dom = minidom.parse(entries_path)
rev = dom.getElementsByTagName('entry')[0].getAttribute('revision')
if rev:
return u'svn-r%s' % rev
return u'svn-unknown'
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)
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if not root_dir:
root_dir = '.'
src_dir = os.path.join(root_dir, app_name)
pieces = fullsplit(root_dir)
if pieces[-1] == '':
len_root_dir = len(pieces) - 1
else:
len_root_dir = len(pieces)
for dirpath, dirnames, filenames in os.walk(src_dir):
# Ignore dirnames that start with '.'
for i, dirname in enumerate(dirnames):
if dirname.startswith('.'):
del dirnames[i]
#if 'conf' in dirpath:
# print dirpath
if '__init__.py' in filenames and not 'conf' in dirpath:
packages.append('.'.join(fullsplit(dirpath)[len_root_dir:]))
elif filenames:
data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
setup(
name=app_name,
version=get_svn_revision(root_dir),
description='Newsroom pages application.',
author='UCLA Student Media',
author_email='someone@media.ucla.edu',
url='http://www.dailybruin.com',
packages = packages,
data_files = data_files,
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Framework :: Django',
],
include_package_data=True,
zip_safe=False,
install_requires=['setuptools'],
)
Jump to Line
Something went wrong with that request. Please try again.