Commit 133f0c6dd58f6ea2c0c329c6fb3c59728be713e6

Authored by Sergio Oliveira
1 parent 679b4f93

Updating installation process

MANIFEST.in
... ... @@ -1,5 +0,0 @@
1   -include colab/templates/*.html
2   -include colab/super_archives/templates/*.html
3   -include colab/super_archives/fixtures/initial_data.json
4   -recursive-include etc *
5   -recursive-include colab/static *
6 0 \ No newline at end of file
README.md
... ... @@ -1,2 +0,0 @@
1   -colab
2   -=====
requirements.txt
1 1 https://www.djangoproject.com/download/1.6b1/tarball/
2 2 South==0.8.1
  3 +psycopg2==2.5.1
3 4 django-piston==0.2.3
4 5 pytz==2011n
5 6 chardet==1.0.1
6 7 python-dateutil==1.5
7 8 django-cliauth==0.9
  9 +
  10 +# Feedzilla (planet) and deps
8 11 https://bitbucket.org/seocam/feedzilla/get/tip.tar.gz # Temporarily work around
9 12 django-common
10 13 django-tagging
... ...
... ... @@ -1,51 +0,0 @@
1   -#!/usr/bin/env python
2   -
3   -from setuptools import setup, find_packages
4   -from setupext import Data_Files, install_Data_Files
5   -
6   -setup(name='colab',
7   - version='3.0',
8   - description = 'Colab, a Software for Communities',
9   - author='Sergio Oliveira',
10   - author_email='seocam@seocam.com',
11   - url='https://bitbucket.org/seocam/atu-colab',
12   - license = "GPL 2",
13   - packages=find_packages(),
14   - package_data={'colab': ['templates/*.html',
15   - 'super_archives/templates/*.html',
16   - 'super_archives/fixtures/initial_data.json']},
17   - data_files=[
18   - Data_Files(base_dir='install_data',
19   - copy_to='static',
20   - template=['recursive-include colab/static *'],
21   - preserve_path=1,
22   - strip_dirs=2),
23   - Data_Files(base_dir='install_data',
24   - copy_to='wsgi',
25   - template=['include etc/apache2/wsgi/colab.wsgi'],
26   - preserve_path=0),
27   - Data_Files(base_dir='install_data',
28   - copy_to='apache-site',
29   - template=['include etc/apache2/sites-available/colab'],
30   - preserve_path=0),
31   - Data_Files(base_dir='install_data',
32   - copy_to='autofs',
33   - template=['include etc/autofs/listas'],
34   - preserve_path=0),
35   - Data_Files(base_dir='install_data',
36   - copy_to='cron.d',
37   - template=['include etc/cron.d/*'],
38   - preserve_path=0),
39   - ],
40   - install_requires=(
41   - 'distribute',
42   - 'Django==1.3.1',
43   - 'South==0.7.3',
44   - 'django-piston==0.2.3',
45   - 'django-cliauth==0.9',
46   - 'pytz==2011n',
47   - 'chardet==1.0.1',
48   - 'python-dateutil==1.5',
49   - 'psycopg2==2.4.4'),
50   - cmdclass = {"install_data": install_Data_Files},
51   -)
setupext/__init__.py
... ... @@ -1,15 +0,0 @@
1   -"Package providing extensions to the standard distutils"
2   -
3   -from install_data import Data_Files, install_Data_Files
4   -
5   -from distutils.command.bdist_wininst import bdist_wininst
6   -
7   -# When building a windows installer, put some more text into
8   -# the long description
9   -class wininst_request_delete(bdist_wininst):
10   - add_text = "\nIf you have installed earlier versions of this package, please remove them through 'Add/Remove Programs' before installing this release."
11   -
12   - def get_inidata(self):
13   - m = self.distribution.metadata
14   - m.long_description = m.long_description + self.add_text
15   - return bdist_wininst.get_inidata(self)
setupext/install_data.py
... ... @@ -1,197 +0,0 @@
1   -# -*- coding: utf-8 -*-
2   -"""install_data.py
3   -
4   -Provides a more sophisticated facility to install data files
5   -than distutils' install_data does.
6   -You can specify your files as a template like in MANIFEST.in
7   -and you have more control over the copy process.
8   -
9   -Copyright 2000 by Rene Liebscher, Germany.
10   -
11   -Permission is hereby granted, free of charge, to any person obtaining
12   -a copy of this software and associated documentation files (the
13   -"Software"), to deal in the Software without restriction, including
14   -without limitation the rights to use, copy, modify, merge, publish,
15   -distribute, sublicense, and/or sell copies of the Software, and to
16   -permit persons to whom the Software is furnished to do so, subject to
17   -the following conditions:
18   -
19   -The above copyright notice and this permission notice shall be included
20   -in all copies or substantial portions of the Software.
21   -
22   -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23   -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24   -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25   -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26   -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27   -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28   -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29   -
30   -"""
31   -
32   -# created 2000/08/01, Rene Liebscher <R.Liebscher@gmx.de>
33   -# modified 2000/12/18, Martin v. Löwis <loewis@informatik.hu-berlin.de>
34   -
35   -###########################################################################
36   -# import some modules we need
37   -
38   -import os,sys,string
39   -from types import StringType,TupleType,ListType
40   -from distutils.util import change_root
41   -from distutils.filelist import FileList
42   -from distutils.command.install_data import install_data
43   -
44   -###########################################################################
45   -# a container class for our more sophisticated install mechanism
46   -
47   -class Data_Files:
48   - """ container for list of data files.
49   - supports alternate base_dirs e.g. 'install_lib','install_header',...
50   - supports a directory where to copy files
51   - supports templates as in MANIFEST.in
52   - supports preserving of paths in filenames
53   - eg. foo/xyz is copied to base_dir/foo/xyz
54   - supports stripping of leading dirs of source paths
55   - eg. foo/bar1/xyz, foo/bar2/abc can be copied to bar1/xyz, bar2/abc
56   - """
57   -
58   - def __init__(self,base_dir=None,files=None,copy_to=None,template=None,preserve_path=0,strip_dirs=0):
59   - self.base_dir = base_dir
60   - self.files = files
61   - self.copy_to = copy_to
62   - if template is not None:
63   - t = []
64   - for item in template:
65   - item = string.strip(item)
66   - if not item:continue
67   - t.append(item)
68   - template = t
69   - self.template = template
70   - self.preserve_path = preserve_path
71   - self.strip_dirs = strip_dirs
72   - self.finalized = 0
73   -
74   - def warn (self, msg):
75   - sys.stderr.write ("warning: %s: %s\n" %
76   - ("install_data", msg))
77   -
78   - def debug_print (self, msg):
79   - """Print 'msg' to stdout if the global DEBUG (taken from the
80   - DISTUTILS_DEBUG environment variable) flag is true.
81   - """
82   - from distutils.core import DEBUG
83   - if DEBUG:
84   - print msg
85   -
86   -
87   - def finalize(self):
88   - """ complete the files list by processing the given template """
89   - if self.finalized:
90   - return
91   - if self.files == None:
92   - self.files = []
93   - if self.template != None:
94   - if type(self.template) == StringType:
95   - self.template = string.split(self.template,";")
96   - filelist = FileList(self.warn,self.debug_print)
97   - for line in self.template:
98   - filelist.process_template_line(string.strip(line))
99   - filelist.sort()
100   - filelist.remove_duplicates()
101   - self.files.extend(filelist.files)
102   - self.finalized = 1
103   -
104   -# end class Data_Files
105   -
106   -###########################################################################
107   -# a more sophisticated install routine than distutils install_data
108   -
109   -class install_Data_Files (install_data):
110   -
111   - def check_data(self,d):
112   - """ check if data are in new format, if not create a suitable object.
113   - returns finalized data object
114   - """
115   - if not isinstance(d, Data_Files):
116   - self.warn(("old-style data files list found "
117   - "-- please convert to Data_Files instance"))
118   - if type(d) is TupleType:
119   - if len(d) != 2 or not (type(d[1]) is ListType):
120   - raise DistutilsSetupError, \
121   - ("each element of 'data_files' option must be an "
122   - "Data File instance, a string or 2-tuple (string,[strings])")
123   - d = Data_Files(copy_to=d[0],files=d[1])
124   - else:
125   - if not (type(d) is StringType):
126   - raise DistutilsSetupError, \
127   - ("each element of 'data_files' option must be an "
128   - "Data File instance, a string or 2-tuple (string,[strings])")
129   - d = Data_Files(files=[d])
130   - d.finalize()
131   - return d
132   -
133   - def run(self):
134   - self.outfiles = []
135   - install_cmd = self.get_finalized_command('install')
136   -
137   - for d in self.data_files:
138   - d = self.check_data(d)
139   -
140   - install_dir = self.install_dir
141   - # alternative base dir given => overwrite install_dir
142   - if d.base_dir != None:
143   - install_dir = getattr(install_cmd,d.base_dir)
144   -
145   - # copy to an other directory
146   - if d.copy_to != None:
147   - if not os.path.isabs(d.copy_to):
148   - # relatiev path to install_dir
149   - dir = os.path.join(install_dir, d.copy_to)
150   - elif install_cmd.root:
151   - # absolute path and alternative root set
152   - dir = change_root(self.root,d.copy_to)
153   - else:
154   - # absolute path
155   - dir = d.copy_to
156   - else:
157   - # simply copy to install_dir
158   - dir = install_dir
159   - # warn if necceassary
160   - self.warn("setup script did not provide a directory to copy files to "
161   - " -- installing right in '%s'" % install_dir)
162   -
163   - dir=os.path.normpath(dir)
164   - # create path
165   - self.mkpath(dir)
166   -
167   - # copy all files
168   - for src in d.files:
169   - if d.strip_dirs > 0:
170   - dst = string.join(string.split(os.path.normcase(src),os.sep)[d.strip_dirs:],os.sep)
171   - else:
172   - dst = src
173   - if d.preserve_path:
174   - # preserve path in filename
175   - self.mkpath(os.path.dirname(os.path.join(dir,dst)))
176   - out = self.copy_file(src, os.path.join(dir,dst))
177   - else:
178   - out = self.copy_file(src, dir)
179   - if type(out) is TupleType:
180   - out = out[0]
181   - self.outfiles.append(out)
182   -
183   - return self.outfiles
184   -
185   - def get_inputs (self):
186   - inputs = []
187   - for d in self.data_files:
188   - d = self.check_data(d)
189   - inputs.append(d.files)
190   - return inputs
191   -
192   - def get_outputs (self):
193   - return self.outfiles
194   -
195   -
196   -###########################################################################
197   -
update-deploy.sh
1 1 #!/bin/bash
2 2  
3   -cd /usr/local/src/colab/
4   -hg pull
5   -hg up
6   -rm -fR dist/
7   -python setup.py sdist
  3 +apt-get install apache2 libapache2-mod-wsgi
  4 +apt-get install libxml2-dev libxslt1-dev # lxml
  5 +apt-get install libpq-dev # psycopg2
  6 +
  7 +cd /usr/local/src/colab2/
  8 +git pull
8 9  
9 10 if [[ $1 == 'deps' ]] ; then
10 11 # com dependencias
11   - /usr/local/django/colab/bin/pip install dist/*.gz -U
12   -else
13   - # sem dependencias
14   - /usr/local/django/colab/bin/pip install dist/*.gz -U --no-deps
  12 +
  13 + /usr/local/django/colab2/bin/pip install -r /usr/local/src/colab2/requirements.txt -U
15 14 fi
16 15  
17   -/usr/local/django/colab/bin/python colab/manage.py syncdb
18   -/usr/local/django/colab/bin/python colab/manage.py migrate
19   -touch /usr/local/django/colab/wsgi/colab.wsgi
  16 +/usr/local/django/colab2/bin/python src/manage.py syncdb
  17 +/usr/local/django/colab2/bin/python src/manage.py migrate
  18 +touch src/colab/wsgi.py
... ...