Move to package layout

Pull files from 3.24 skeleton and move existing files to the package layout (i.e. cubes/celery/* -> cubicweb_celery except __init__.py which is empty). Update MANIFEST.in accordingly.

Added an RPM spec file (from skeleton) along the way.

Update Debian packaging to only build one binary package.

Closes #15599451.

authorDenis Laxalde <denis.laxalde@logilab.fr>
changeset117ba0fe2252
branchdefault
phasepublic
hiddenno
parent revision#d3c3f0a5fb9d Added tag 0.2.0, debian/0.2.0-1 for changeset 136b5bb042f5
child revision#0562b43f1944 CWTask: add a cnx() context manager to handle CW connection, #67d79ba0a6d7 [pkg] Bump to a development version
files modified by this revision
MANIFEST.in
cubes/celery/__init__.py
cubes/celery/__pkginfo__.py
cubes/celery/migration/ddl.sql
cubes/celery/migration/postcreate.py
cubes/celery/migration/table.sql
cubes/celery/sobjects.py
cubes/celery/test/data/bootstrap_cubes
cubes/celery/test/data/celeryconfig.py
cubes/celery/test/data/sobjects.py
cubes/celery/test/test_celery.py
cubicweb-celery.spec
cubicweb_celery/__init__.py
cubicweb_celery/__pkginfo__.py
cubicweb_celery/migration/ddl.sql
cubicweb_celery/migration/postcreate.py
cubicweb_celery/migration/table.sql
cubicweb_celery/sobjects.py
debian/control
debian/cubicweb-celery.install
debian/python-cubicweb-celery.install
debian/rules
setup.py
test/data/bootstrap_cubes
test/data/celeryconfig.py
test/data/sobjects.py
test/test_celery.py
tox.ini
tweak-venv.sh
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1475649742 -7200
# Wed Oct 05 08:42:22 2016 +0200
# Node ID 117ba0fe2252f6e228894bdc1a1fd4f3e0e8076c
# Parent d3c3f0a5fb9df349fd237282f634334ab4355d41
Move to package layout

Pull files from 3.24 skeleton and move existing files to the package layout
(i.e. cubes/celery/* -> cubicweb_celery except __init__.py which is empty).
Update MANIFEST.in accordingly.

Added an RPM spec file (from skeleton) along the way.

Update Debian packaging to only build one binary package.

Closes #15599451.

diff --git a/MANIFEST.in b/MANIFEST.in
@@ -1,1 +1,11 @@
1 -recursive-include cubes/celery *.py
2 +include *.py
3 +include */*.py
4 +recursive-include cubicweb_celery *.py
5 +recursive-include cubicweb_celery/data *.gif *.png *.ico *.css *.js
6 +recursive-include cubicweb_celery/i18n *.po
7 +recursive-include cubicweb_celery/wdoc *
8 +recursive-include cubicweb_celery/migration *.sql
9 +recursive-include test/data bootstrap_cubes *.py
10 +include tox.ini
11 +recursive-include debian changelog compat control copyright rules
12 +include cubicweb-celery.spec
diff --git a/cubes/celery/__init__.py b/cubes/celery/__init__.py
diff --git a/cubes/celery/test/data/bootstrap_cubes b/cubes/celery/test/data/bootstrap_cubes
@@ -1,1 +0,0 @@
13 -celery
diff --git a/cubicweb-celery.spec b/cubicweb-celery.spec
@@ -0,0 +1,47 @@
14 +# for el5, force use of python2.6
15 +%if 0%{?el5}
16 +%define python python26
17 +%define __python /usr/bin/python2.6
18 +%else
19 +%define python python
20 +%define __python /usr/bin/python
21 +%endif
22 +%{!?_python_sitelib: %define _python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
23 +
24 +Name:           cubicweb-celery
25 +Version:        0.1.0
26 +Release:        logilab.1%{?dist}
27 +Summary:        Celery integration with CubicWeb
28 +Group:          Applications/Internet
29 +License:        LGPL
30 +Source0:        cubicweb-celery-%{version}.tar.gz
31 +
32 +BuildArch:      noarch
33 +BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
34 +
35 +BuildRequires:  %{python} %{python}-setuptools
36 +Requires:       cubicweb >= 3.24.0.dev0
37 +Requires:       %{python}-six >= 1.4.0
38 +
39 +%description
40 +Celery integration with CubicWeb
41 +
42 +%prep
43 +%setup -q -n cubicweb-celery-%{version}
44 +%if 0%{?el5}
45 +# change the python version in shebangs
46 +find . -name '*.py' -type f -print0 |  xargs -0 sed -i '1,3s;^#!.*python.*$;#! /usr/bin/python2.6;'
47 +%endif
48 +
49 +%install
50 +%{__python} setup.py --quiet install --no-compile --prefix=%{_prefix} --root="$RPM_BUILD_ROOT"
51 +# remove generated .egg-info file
52 +rm -rf $RPM_BUILD_ROOT/usr/lib/python*
53 +
54 +
55 +%clean
56 +rm -rf $RPM_BUILD_ROOT
57 +
58 +%files
59 +%defattr(-, root, root)
60 +%{_prefix}/share/cubicweb/cubes/*
diff --git a/cubicweb_celery/__init__.py b/cubicweb_celery/__init__.py
@@ -1,5 +1,10 @@
61 +"""cubicweb-celery application package
62 +
63 +Celery integration with CubicWeb
64 +"""
65 +
66  import contextlib
67  import logging
68  import os.path as osp
69 
70  from optparse import make_option
diff --git a/cubes/celery/__pkginfo__.py b/cubicweb_celery/__pkginfo__.py
@@ -1,21 +1,26 @@
71  # pylint: disable=W0622
72 -"""cubicweb-celerytest application packaging information"""
73 +"""cubicweb-celery application packaging information"""
74 
75 -modname = 'celery'
76 +
77 +modname = 'cubicweb_celery'
78  distname = 'cubicweb-celery'
79 
80  numversion = (0, 2, 0)
81  version = '.'.join(str(num) for num in numversion)
82 
83  license = 'LGPL'
84 -author = 'Unlish'
85 -author_email = 'contact@unlish.com'
86 +author = 'Christophe de Vienne'
87 +author_email = 'christophe@unlish.com'
88  description = 'Celery cube'
89  web = 'http://www.cubicweb.org/project/%s' % distname
90 
91 -__depends__ = {'cubicweb': '>= 3.19.6'}
92 +__depends__ = {
93 +    'cubicweb': '>= 3.24.0.dev0',
94 +    'six': '>= 1.4.0',
95 +    'celery': None,
96 +}
97  __recommends__ = {}
98 
99  classifiers = [
100      'Environment :: Web Environment',
101      'Framework :: CubicWeb',
diff --git a/cubes/celery/migration/ddl.sql b/cubicweb_celery/migration/ddl.sql
diff --git a/cubes/celery/migration/postcreate.py b/cubicweb_celery/migration/postcreate.py
diff --git a/cubes/celery/migration/table.sql b/cubicweb_celery/migration/table.sql
diff --git a/cubes/celery/sobjects.py b/cubicweb_celery/sobjects.py
diff --git a/debian/control b/debian/control
@@ -5,19 +5,19 @@
102  Build-Depends:
103   debhelper (>= 9),
104   dh-python,
105   python (>= 2.6.5),
106   python-setuptools,
107 - cubicweb-common (>= 3.20),
108 + cubicweb-common (>= 3.24.0.dev0),
109  Standards-Version: 3.9.6
110  X-Python-Version: >= 2.6
111  Homepage: https://www.cubicweb.org/project/cubicweb-celery
112 
113  Package: cubicweb-celery
114  Architecture: all
115  Depends:
116 - cubicweb-common (>= 3.20),
117 + cubicweb-common (>= 3.24.0.dev0),
118   python-six (>= 1.4.0),
119   python-celery,
120   ${python:Depends},
121   ${misc:Depends},
122  Description: Celery integration with CubicWeb
@@ -25,23 +25,7 @@
123   .
124   Allows a CubicWeb application to use Celery to run distributed CubicWeb
125   (or not) tasks from a CubicWeb application.
126   .
127   This package will install the Celery cube allowing to declare Celery
128 - tasks running in a CubicWeb application.
129 - 
130 -Package: python-cubicweb-celery
131 -Architecture: all
132 -Section: python
133 -Depends:
134 - cubicweb-common (>= 3.20),
135 - python-celery,
136 - ${python:Depends},
137 - ${misc:Depends},
138 -Description: Celery worker module for cubicweb-celery
139 - CubicWeb is a semantic web application framework.
140 - .
141 - Allows a CubicWeb application to use Celery to run distributed CubicWeb
142 - (or not) tasks from a CubicWeb application.
143 - .
144 - This package will install the Celery worker module allowing to start Celery
145 - workers running tasks for a CubicWeb application.
146 + tasks running in a CubicWeb application along with the Celery worker module
147 + allowing to start Celery workers running tasks for a CubicWeb application.
diff --git a/debian/cubicweb-celery.install b/debian/cubicweb-celery.install
@@ -1,1 +0,0 @@
148 -usr/share/cubicweb/cubes/celery
149 \ No newline at end of file
diff --git a/debian/python-cubicweb-celery.install b/debian/python-cubicweb-celery.install
@@ -1,1 +0,0 @@
150 -usr/lib/python*
151 \ No newline at end of file
diff --git a/debian/rules b/debian/rules
@@ -1,10 +1,4 @@
152  #!/usr/bin/make -f
153 
154 -export NO_SETUPTOOLS=1
155 -
156  %:
157  	dh $@ --with python2
158 -
159 -override_dh_python2:
160 -	dh_python2 --no-guessing-deps
161 -	dh_python2 -i /usr/share/cubicweb
diff --git a/setup.py b/setup.py
@@ -1,19 +1,82 @@
162 -import os
163 -from glob import glob
164 +#!/usr/bin/env python
165 +# pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611
166 +#
167 +# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
168 +# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
169 +#
170 +# This file is part of a cubicweb-celery.
171 +#
172 +# CubicWeb is free software: you can redistribute it and/or modify it under the
173 +# terms of the GNU Lesser General Public License as published by the Free
174 +# Software Foundation, either version 2.1 of the License, or (at your option)
175 +# any later version.
176 +#
177 +# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
178 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
179 +# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
180 +# details.
181 +#
182 +# You should have received a copy of the GNU Lesser General Public License
183 +# along with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
184 +"""cubicweb_celery setup module using data from
185 +cubicweb_celery/__pkginfo__.py file
186 +"""
187 +
188 +from os.path import join, dirname
189 +
190 +from setuptools import find_packages, setup
191 +
192 +
193 +here = dirname(__file__)
194 
195 -from setuptools import setup
196 +# load metadata from the __pkginfo__.py file so there is no risk of conflict
197 +# see https://packaging.python.org/en/latest/single_source_version.html
198 +pkginfo = join(here, 'cubicweb_celery', '__pkginfo__.py')
199 +__pkginfo__ = {}
200 +with open(pkginfo) as f:
201 +    exec(f.read(), __pkginfo__)
202 +
203 +# get required metadatas
204 +distname = __pkginfo__['distname']
205 +version = __pkginfo__['version']
206 +license = __pkginfo__['license']
207 +description = __pkginfo__['description']
208 +web = __pkginfo__['web']
209 +author = __pkginfo__['author']
210 +author_email = __pkginfo__['author_email']
211 +classifiers = __pkginfo__['classifiers']
212 +
213 +with open(join(here, 'README.rst')) as f:
214 +    long_description = f.read()
215 +
216 +# get optional metadatas
217 +data_files = __pkginfo__.get('data_files', None)
218 +dependency_links = __pkginfo__.get('dependency_links', ())
219 +
220 +requires = {}
221 +for entry in ("__depends__",):  # "__recommends__"):
222 +    requires.update(__pkginfo__.get(entry, {}))
223 +install_requires = ["{0} {1}".format(d, v and v or "").strip()
224 +                    for d, v in requires.items()]
225 +
226 
227  setup(
228 -    name='cubicweb-celery',
229 -    version='0.2.0',
230 -    description='Celery integration with CubicWeb',
231 -    author='Christophe de Vienne',
232 -    author_email='christophe@unlish.com',
233 -    packages=['cubicweb_celery'],
234 -    install_requires=[
235 -        'celery', 'cubicweb'
236 -    ],
237 -    data_files=[
238 -        (os.path.join('share', 'cubicweb', 'cubes', 'celery'),
239 -         glob('cubes/celery/*.py'))
240 -    ])
241 +    name=distname,
242 +    version=version,
243 +    license=license,
244 +    description=description,
245 +    long_description=long_description,
246 +    author=author,
247 +    author_email=author_email,
248 +    url=web,
249 +    classifiers=classifiers,
250 +    packages=find_packages(exclude=['test']),
251 +    install_requires=install_requires,
252 +    include_package_data=True,
253 +    entry_points={
254 +        'cubicweb.cubes': [
255 +            'celery=cubicweb_celery',
256 +        ],
257 +    },
258 +    zip_safe=False,
259 +)
diff --git a/test/data/bootstrap_cubes b/test/data/bootstrap_cubes
@@ -0,0 +1,1 @@
260 +celery
diff --git a/cubes/celery/test/data/celeryconfig.py b/test/data/celeryconfig.py
diff --git a/cubes/celery/test/data/sobjects.py b/test/data/sobjects.py
diff --git a/cubes/celery/test/test_celery.py b/test/test_celery.py
diff --git a/tox.ini b/tox.ini
@@ -1,22 +1,21 @@
261  [tox]
262 -envlist = py27,flake8
263 +envlist = py27,py34,flake8
264 
265  [testenv]
266 +sitepackages = true
267  deps =
268 -    pytest
269 +  http://hg.logilab.org/master/cubicweb/archive/4e3ae4bd3fd5.tar.bz2#egg=cubicweb
270 +  pytest
271  commands =
272 -    {envpython} -m pytest {posargs:{toxinidir}/cubes/celery/test}
273 +  {envpython} -m pytest {posargs:test}
274 
275  [testenv:flake8]
276  skip_install = true
277  whitelist_externals =
278    flake8
279  deps =
280    flake8
281 -commands = flake8 {posargs}
282 -
283 -[pytest]
284 -python_files = *test_*.py
285 +commands = flake8
286 
287  [flake8]
288 -exclude = cubes/celery/migration/*,cubes/celery/test/data/*,.tox/*
289 +exclude = cubicweb_celery/migration/*,test/data/*,.tox/*
diff --git a/tweak-venv.sh b/tweak-venv.sh
@@ -1,11 +0,0 @@
290 -#!/bin/bash
291 -
292 -MYPATH=$(pwd)
293 -MODNAME=celery
294 -
295 -if [ -z "$VIRTUAL_ENV" ]; then
296 -    exit 1
297 -fi
298 -
299 -rm -rf $VIRTUAL_ENV/share/cubicweb/cubes/$MODNAME
300 -ln -s $MYPATH/cubes/celery $VIRTUAL_ENV/share/cubicweb/cubes/$MODNAME