Skip to content

Commit

Permalink
stdeb nearly produces a totally-working .deb now.
Browse files Browse the repository at this point in the history
  • Loading branch information
philipn committed Oct 23, 2011
1 parent 78e206f commit 9ad7072
Show file tree
Hide file tree
Showing 77 changed files with 85 additions and 37 deletions.
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include CONTRIBUTING
include COPYING
include INSTALL
include README
recursive-include docs *
1 change: 1 addition & 0 deletions install_config
1 change: 0 additions & 1 deletion install_config/daisydiff.war

This file was deleted.

2 changes: 0 additions & 2 deletions media/.gitignore

This file was deleted.

14 changes: 14 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
setuptools
django>=1.3
html5lib>=0.90
Sphinx>=1.0.7
sorl-thumbnail>=11.01
python-dateutil>=1.5
pysolr
django-haystack
django-randomfilenamestorage
django-guardian
South
django-staticfiles>=1.1.2
https://bitbucket.org/ubernostrum/django-registration/get/tip.tar.gz#egg=django-registration
-e git+git://github.com/philipn/olwidget.git@custom_base_layers_fixed#egg=django-olwidget
1 change: 1 addition & 0 deletions sapling/etc/install_config/daisydiff.war
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion sapling/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# We have to hard-code these here, as we run a few setup commands (in
# setup_all) that execute before the settings can be safely loaded.
DATA_ROOT = os.path.join(sys.prefix, 'share', 'localwiki')
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..')
PROJECT_ROOT = os.path.split(os.path.abspath(__file__))[0]


def main(set_apps_path=True):
if set_apps_path:
Expand Down
2 changes: 1 addition & 1 deletion sapling/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
MANAGERS = ADMINS

DATA_ROOT = os.path.join(sys.prefix, 'share', 'localwiki')
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..')
PROJECT_ROOT = os.path.join(os.path.dirname(__file__))

DATABASES = {
'default': {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
30 changes: 23 additions & 7 deletions sapling/utils/management/commands/init_data_dir.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import os
import shutil
import errno


class Command(object):
Expand All @@ -13,20 +14,35 @@ def handle(self, *args, **kwargs):
share_dir = os.path.join(sys.prefix, 'share')
data_dir = os.path.join(share_dir, 'localwiki')

# Check to make sure the data directory doesn't already exist.
if os.path.exists(data_dir):
sys.stderr.write("Data directory %s already exists!\n" % data_dir)
return

# Create the data directory and copy defaults into it.
if not os.path.exists(share_dir):
os.makedirs(share_dir)
defaults_dir = os.path.join(self.PROJECT_ROOT, 'install_config',

defaults_dir = os.path.join(self.PROJECT_ROOT, 'etc', 'install_config',
'defaults')
shutil.copytree(os.path.join(defaults_dir, 'localwiki'), data_dir)

for item in os.listdir(os.path.join(defaults_dir, 'localwiki')):
if os.path.exists(os.path.join(data_dir, item)):
sys.stderr.write("Directory %s already exists! Skipping..\n" %
os.path.join(data_dir, item))
continue
src = os.path.join(defaults_dir, 'localwiki', item)
dst = os.path.join(data_dir, item)
try:
shutil.copytree(src, dst)
except OSError as exc:
if exc.errno == errno.ENOTDIR:
shutil.copy(src, dst)
else:
raise

# Rename localsettings.py.template to localsettings.py
os.rename(os.path.join(data_dir, 'conf', 'localsettings.py.template'),
os.path.join(data_dir, 'conf', 'localsettings.py'))

print ('Created data directory in %s\n' % data_dir)


def run(DATA_ROOT=None, PROJECT_ROOT=None):
c = Command()
c.DATA_ROOT = DATA_ROOT
Expand Down
2 changes: 1 addition & 1 deletion sapling/utils/management/commands/init_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def create_spatial_template(self):
elif which_pgis == '3':
script = 'create_template_postgis-1.3.sh'

script_path = os.path.join(self.PROJECT_ROOT,
script_path = os.path.join(self.PROJECT_ROOT, 'etc',
'install_config', 'postgis_template_scripts', script)
# Make a temp file so postgres user can always read it.
fd, temp_path = tempfile.mkstemp()
Expand Down
56 changes: 34 additions & 22 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# you can't import this from another package, when you don't know if
# that package is installed yet.
def find_package_data(

where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
Expand Down Expand Up @@ -51,8 +50,6 @@ def find_package_data(
Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.
"""


out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
Expand Down Expand Up @@ -101,12 +98,40 @@ def find_package_data(

def gen_data_files(*dirs):
results = []
for src_dir in dirs:
for dir_info in dirs:
if type(dir_info) == tuple:
src_dir, name = dir_info
else:
name = dir_info
src_dir = dir_info
top_root = None
for root, dirs, files in os.walk(src_dir):
results.append((root, map(lambda f: root + "/" + f, files)))
if top_root is None:
top_root = root
root_name = root.replace(top_root, name, 1)
results.append((root_name, map(lambda f: root + "/" + f, files)))
return results


install_requires = [
'setuptools',
'django>=1.3',
'html5lib>=0.90',
'Sphinx>=1.0.7',
'sorl-thumbnail>=11.01',
'python-dateutil>=1.5',
'pysolr',
'django-haystack',
'django-randomfilenamestorage',
'django-guardian',
'South',
'django-staticfiles>=1.1.2',
'django-registration==0.8.0-alpha-1',
'django-olwidget==0.46-custom1',
]
if int(os.getenv('DISABLE_INSTALL_REQUIRES', '0')):
install_requires = None

setup(
name='localwiki',
version=get_version(),
Expand All @@ -116,24 +141,11 @@ def gen_data_files(*dirs):
author_email='philip@localwiki.org',
packages=find_packages(),
package_dir={'sapling': 'sapling'},
data_files=gen_data_files('install_config', 'templates', 'themes'),
data_files=gen_data_files(
('docs', 'share/localwiki/docs')
),
package_data=find_package_data(),
install_requires=[
'setuptools',
'django>=1.3',
'html5lib>=0.90',
'Sphinx>=1.0.7',
'sorl-thumbnail>=11.01',
'python-dateutil==1.5',
'pysolr',
'django-haystack',
'django-randomfilenamestorage',
'django-guardian',
'South',
'django-staticfiles>=1.1.2',
'django-registration==0.8.0-alpha-1',
'django-olwidget==0.46-custom1',
],
install_requires=install_requires,
dependency_links=[
'https://bitbucket.org/ubernostrum/django-registration/get/tip.tar.gz#egg=django-registration-0.8.0-alpha-1',
'https://github.com/philipn/olwidget/tarball/custom_base_layers_fixed#egg=django-olwidget-0.46-custom1',
Expand Down
2 changes: 0 additions & 2 deletions static/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions stdeb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[DEFAULT]
Depends: python-pip, python-virtualenv, python-setuptools, solr-jetty, python-lxml, python-imaging, gdal-bin, proj, postgresql-8.4-postgis, python-psycopg2
Setup-Env-Vars: DISABLE_INSTALL_REQUIRES=1

0 comments on commit 9ad7072

Please sign in to comment.