From 2893d9691374c9962d8af73495cd2ebc87101c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 7 Jul 2017 07:58:51 +0200 Subject: [PATCH] add skeleton project files --- MANIFEST.in | 4 ++ README | 22 +++++++ combo_plugin_gnm/__init__.py | 31 ++++++++++ setup.py | 109 +++++++++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+) create mode 100644 MANIFEST.in create mode 100644 README create mode 100644 combo_plugin_gnm/__init__.py create mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..61ad30b --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,4 @@ +include MANIFEST.in +include COPYING +include README +include VERSION diff --git a/README b/README new file mode 100644 index 0000000..e201ff3 --- /dev/null +++ b/README @@ -0,0 +1,22 @@ +Combo GNM Plug-in +================= + +Extension module for the combo content management system, with various +developments that are at the moment at least specific to the GNM project. + + +License +------- + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU Affero General Public License as published by the Free +Software Foundation, either version 3 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 Affero General Public License for more +details. + +You should have received a copy of the GNU Affero General Public License along +with this program. If not, see . diff --git a/combo_plugin_gnm/__init__.py b/combo_plugin_gnm/__init__.py new file mode 100644 index 0000000..1d46b79 --- /dev/null +++ b/combo_plugin_gnm/__init__.py @@ -0,0 +1,31 @@ +# combo-plugin-gnm - Combo GNM plugin +# Copyright (C) 2017 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +import django.apps +from django.utils.translation import ugettext_lazy as _ + + +class Plugin(object): + def get_apps(self): + return [__name__] + + +class AppConfig(django.apps.AppConfig): + name = __name__ + verbose_name = _('GNM Extension') + + +default_app_config = __name__ + '.AppConfig' diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0bd93ce --- /dev/null +++ b/setup.py @@ -0,0 +1,109 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +import glob +import os +import re +import subprocess +import sys + +from setuptools.command.install_lib import install_lib as _install_lib +from distutils.command.build import build as _build +from distutils.command.sdist import sdist +from distutils.cmd import Command +from setuptools import setup, find_packages + +class eo_sdist(sdist): + def run(self): + if os.path.exists('VERSION'): + os.remove('VERSION') + version = get_version() + version_file = open('VERSION', 'w') + version_file.write(version) + version_file.close() + sdist.run(self) + if os.path.exists('VERSION'): + os.remove('VERSION') + +def get_version(): + if os.path.exists('VERSION'): + version_file = open('VERSION', 'r') + version = version_file.read() + version_file.close() + return version + if os.path.exists('.git'): + p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE) + result = p.communicate()[0] + if p.returncode == 0: + version = result.split()[0][1:] + version = version.replace('-', '.') + return version + return '0' + + +class compile_translations(Command): + description = 'compile message catalogs to MO files via django compilemessages' + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + try: + from django.core.management import call_command + for path, dirs, files in os.walk('combo_plugin_gnm'): + if 'locale' not in dirs: + continue + curdir = os.getcwd() + os.chdir(os.path.realpath(path)) + call_command('compilemessages') + os.chdir(curdir) + except ImportError: + sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n') + + +class build(_build): + sub_commands = [('compile_translations', None)] + _build.sub_commands + + +class install_lib(_install_lib): + def run(self): + self.run_command('compile_translations') + _install_lib.run(self) + + +setup( + name='combo_plugin_gnm', + version=get_version(), + description='Combo GNM plugin', + author='Frederic Peters', + author_email='fpeters@entrouvert.com', + packages=find_packages(), + include_package_data=True, + url='https://dev.entrouvert.org/projects/combo/', + classifiers=[ + 'Development Status :: 2 - Pre-Alpha', + 'Environment :: Web Environment', + 'Framework :: Django', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + ], + install_requires=['django>=1.8, <1.9', + ], + zip_safe=False, + entry_points={ + 'combo.plugin': ['gnm = combo_plugin_gnm:Plugin'], + }, + cmdclass={ + 'build': build, + 'compile_translations': compile_translations, + 'install_lib': install_lib, + 'sdist': eo_sdist, + } +)