Commit ae2e3a64 authored by François Ferry's avatar François Ferry

initial commit

parents
Pipeline #25250 failed with stage
in 1 minute and 22 seconds
image: python
stages:
- tests
- after-tests
before_script:
- pip install tox
py3:
stage: tests
script: tox -e py3
flake8:
stage: tests
script: tox -e flake8
check-manifest:
stage: tests
script: tox -e check-manifest
black:
stage: tests
script: tox -e black
# If you have mypy set up
# mypy:
# stage: tests
# script: tox -e mypy
# If you have your project on readthedocs, you can automatically trigger its
# build by setting:
# - READTHEDOCS_TOKEN
# - READTHEDOCS_ID
# in your heptapod project Settings > CI/CD > Variables.
# You can find those secrets by creating a new integration in your readthedocs
# project here: https://readthedocs.org/dashboard/cubicweb_tuto/integrations/
#
# Related documentation:
# https://docs.readthedocs.io/en/latest/webhooks.html#using-the-generic-api-integration
#
# trigger-readthedocs:
# only:
# refs:
# - branch/default
# stage: after-tests
# script:
# # regarding the " everywhere when there is a '%': yaml is extremly weird when % are involved
# - curl -X POST -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/cubicweb_tuto/${READTHEDOCS_ID} -w "\nhttp code:"\ "%{http_code}\n" -f
include *.py
include */*.py
recursive-include cubicweb_tuto *.py
recursive-include cubicweb_tuto/data *.gif *.png *.ico *.css *.js
recursive-include cubicweb_tuto/i18n *.po
recursive-include cubicweb_tuto/wdoc *
recursive-include test/data bootstrap_cubes *.py
include *.ini
prune debian
exclude cubicweb-tuto.spec
Summary
-------
A cube for new CW tutorial
# for el5, force use of python2.6
%if 0%{?el5}
%define python python26
%define __python /usr/bin/python2.6
%else
%define python python
%define __python /usr/bin/python
%endif
%{!?_python_sitelib: %define _python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Name: cubicweb-tuto
Version: 0.1.0
Release: logilab.1%{?dist}
Summary: A cube for new CW tutorial
Group: Applications/Internet
License: LGPL
Source0: cubicweb-tuto-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: %{python} %{python}-setuptools
Requires: cubicweb >= 3.29.0
Requires: %{python}-six >= 1.4.0
%description
A cube for new CW tutorial
%prep
%setup -q -n cubicweb-tuto-%{version}
%if 0%{?el5}
# change the python version in shebangs
find . -name '*.py' -type f -print0 | xargs -0 sed -i '1,3s;^#!.*python.*$;#! /usr/bin/python2.6;'
%endif
%install
%{__python} setup.py --quiet install --no-compile --prefix=%{_prefix} --root="$RPM_BUILD_ROOT"
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-, root, root)
%{_python_sitelib}/*
"""cubicweb-tuto application package
A cube for new CW tutorial
"""
def includeme(config):
pass
# pylint: disable=W0622
"""cubicweb-tuto application packaging information"""
modname = 'cubicweb_tuto'
distname = 'cubicweb-tuto'
numversion = (0, 1, 0)
version = '.'.join(str(num) for num in numversion)
license = 'LGPL'
author = 'LOGILAB S.A. (Paris, FRANCE)'
author_email = 'contact@logilab.fr'
description = 'A cube for new CW tutorial'
web = 'http://www.cubicweb.org/project/%s' % distname
__depends__ = {'cubicweb': '>= 3.29.0'}
__recommends__ = {}
classifiers = [
'Environment :: Web Environment',
'Framework :: CubicWeb',
'Programming Language :: Python :: 3',
'Programming Language :: JavaScript',
]
# -*- coding: utf-8 -*-
# copyright 2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto entity's classes"""
# -*- coding: utf-8 -*-
# copyright 2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto specific hooks and operations"""
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
# -*- coding: utf-8 -*-
# copyright 2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto postcreate script, executed at instance creation time or when
the cube is added to an existing instance.
You could setup site properties or a workflow here for example.
"""
# Example of site property change
# set_property('ui.site-title', "<sitename>")
# -*- coding: utf-8 -*-
# copyright 2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto schema"""
# -*- coding: utf-8 -*-
# copyright 2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto views/forms/actions/components for web ui"""
cubicweb-tuto (0.1.0-1) UNRELEASED; urgency=medium
* Initial release.
-- LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr> Mon, 14 Dec 2020 08:46:21 +0000
Source: cubicweb-tuto
Section: web
Priority: optional
Maintainer: LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
Build-Depends:
debhelper (>= 9),
dh-python,
python3-all,
python3-setuptools,
python3-pytest,
Standards-Version: 4.3.0
X-Python3-Version: >= 3.4
Package: python3-cubicweb-tuto
Architecture: all
Depends:
${python3:Depends},
${misc:Depends},
Description: A cube for new CW tutorial
CubicWeb is a semantic web application framework.
.
A cube for new CW tutorial
.
This package will install all the components you need to run an application
using the cubicweb-tuto cube.
Upstream Author:
LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
Copyright:
Copyright (c) 2020 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr -- mailto:contact@logilab.fr
test
tox.ini
cubicweb-tuto.egg-info
#!/usr/bin/make -f
export PYBUILD_NAME = cubicweb-tuto
export PYBUILD_OPTION = --test-pytest
%:
dh $@ --with python3 --buildsystem=pybuild
extend-diff-ignore = "^([^/]*\.spec$)"
Tests: pytest
Depends:
@builddeps@,
# Uncomment if the tests require database access
#python3-cubicweb-postgresql-support
Restrictions:
allow-stderr,
# Uncomment if the tests require database access
#isolation-container,
#!/bin/sh
set -e
set -x
### Setup tests
# Uncomment if tests require database access
#service postgresql restart || service postgresql start
#trap 'service postgresql stop' EXIT
cp -r test tox.ini "$AUTOPKGTEST_TMP"
chown -R nobody:nogroup "$AUTOPKGTEST_TMP"
### Run tests
for py in $(py3versions -r 2>/dev/null); do
cd "$AUTOPKGTEST_TMP"
echo "Testing with $py:"
su nobody --shell /bin/sh \
-c "$py -m pytest -v"
done
#!/usr/bin/env python
# pylint: disable=W0142,W0403,W0404,W0613,W0622,W0622,W0704,R0904,C0103,E0611
#
# copyright 2003-2016 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of a cubicweb-tuto.
#
# CubicWeb is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb_tuto setup module using data from
cubicweb_tuto/__pkginfo__.py file
"""
from os.path import join, dirname
from setuptools import find_packages, setup
here = dirname(__file__)
# load metadata from the __pkginfo__.py file so there is no risk of conflict
# see https://packaging.python.org/en/latest/single_source_version.html
pkginfo = join(here, 'cubicweb_tuto', '__pkginfo__.py')
__pkginfo__ = {}
with open(pkginfo) as f:
exec(f.read(), __pkginfo__)
# get required metadatas
distname = __pkginfo__['distname']
version = __pkginfo__['version']
license = __pkginfo__['license']
description = __pkginfo__['description']
web = __pkginfo__['web']
author = __pkginfo__['author']
author_email = __pkginfo__['author_email']
classifiers = __pkginfo__['classifiers']
with open(join(here, 'README')) as f:
long_description = f.read()
# get optional metadatas
data_files = __pkginfo__.get('data_files', None)
dependency_links = __pkginfo__.get('dependency_links', ())
requires = {}
for entry in ("__depends__",): # "__recommends__"):
requires.update(__pkginfo__.get(entry, {}))
install_requires = ["{0} {1}".format(d, v and v or "").strip()
for d, v in requires.items()]
setup(
name=distname,
version=version,
license=license,
description=description,
long_description=long_description,
author=author,
author_email=author_email,
url=web,
classifiers=classifiers,
packages=find_packages(exclude=['test']),
install_requires=install_requires,
include_package_data=True,
entry_points={
'cubicweb.cubes': [
'tuto=cubicweb_tuto',
],
},
zip_safe=False,
)
# copyright 2020 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr -- mailto:contact@logilab.fr
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 2.1 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""cubicweb-tuto automatic tests
uncomment code below if you want to activate automatic test for your cube:
.. sourcecode:: python
from cubicweb.devtools.testlib import AutomaticWebTest
class AutomaticWebTest(AutomaticWebTest):
'''provides `to_test_etypes` and/or `list_startup_views` implementation
to limit test scope
'''
def to_test_etypes(self):
'''only test views for entities of the returned types'''
return set(('My', 'Cube', 'Entity', 'Types'))
def list_startup_views(self):
'''only test startup views of the returned identifiers'''
return ('some', 'startup', 'views')
"""
from cubicweb.devtools import testlib
class DefaultTC(testlib.CubicWebTC):
def test_something(self):
self.skipTest('this cube has no test')
if __name__ == '__main__':
from unittest import main
main()
[tox]
envlist = py3,flake8,check-manifest,black
[testenv]
deps =
pytest
commands =
{envpython} -m pytest {posargs:test}
[testenv:flake8]
basepython = python3
skip_install = true
deps =
flake8 >= 3.6
commands = flake8
[testenv:check-manifest]
skip_install = true
deps =
check-manifest
commands =
{envpython} -m check_manifest {toxinidir}
[testenv:mypy]
deps =
mypy >= 0.761
commands = mypy --ignore-missing-imports cubicweb_tuto
[testenv:black]
basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black --check .
[testenv:black-run]
basepython = python3
skip_install = true
deps =
black >= 19.10b0
commands = black .
[testenv:pypi-publish]
basepython = python3
skip_install = true
whitelist_externals = rm
deps =
twine
passenv =
TWINE_USERNAME
TWINE_PASSWORD
commands =
rm -rf build dist .egg .egg-info
python3 setup.py sdist bdist_wheel
twine check dist/*
twine upload --skip-existing dist/*
[testenv:deb-publish]
passenv = JENKINS_USER JENKINS_TOKEN
basepython = python3
skip_install = true
whitelist_externals =
rm
sh
hg
deps =
httpie
commands =
hg clean --all --dirs --files
rm -rf build dist .egg .egg-info
python3 setup.py sdist
sh -c "PACKAGE_NAME=$(python3 setup.py --name) && VERSION=$(python3 setup.py --version) && \
cd dist && \
tar xf $PACKAGE_NAME-$VERSION.tar.gz && \
cd $PACKAGE_NAME-$VERSION && \
cp -a {toxinidir}/debian . && \
mk-origtargz --rename ../$PACKAGE_NAME-$VERSION.tar.gz && \
dpkg-buildpackage -us -uc --no-check-builddeps --build=source "
sh -c "cd dist && dcmd zip latest.zip *.changes"
http -f POST https://{env:JENKINS_USER}:{env:JENKINS_TOKEN}@jenkins.intra.logilab.fr/job/pkg-from-dsc/buildWithParameters DIST=buster source.zip@dist/latest.zip REPO=buster PUBLISH=true
[flake8]
basepython = python3
format = pylint
ignore = W503, E203, E731, E231
max-line-length = 100
exclude = cubicweb_tuto/migration/*,test/data/*,.tox/*
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment