From f7fa258c5d1daa8bd6a6a9c220f8e9c0267d7ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 8 Jun 2012 19:33:53 +0200 Subject: [PATCH] Simplify module information with python configuration review363001 --- MANIFEST.in | 1 + README | 1 - __tryton__.py | 49 ------------------------------------------------- setup.py | 33 +++++++++++++++++++++------------ tryton.cfg | 12 ++++++++++++ 5 files changed, 34 insertions(+), 62 deletions(-) delete mode 100644 __tryton__.py create mode 100644 tryton.cfg diff --git a/MANIFEST.in b/MANIFEST.in index f186207639..8b691e0fc5 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,6 +3,7 @@ include README include COPYRIGHT include CHANGELOG include LICENSE +include tryton.cfg include *.xml include *.odt include locale/*.po diff --git a/README b/README index be1cf167ea..631741218c 100644 --- a/README +++ b/README @@ -2,7 +2,6 @@ trytond_carrier_percentage ========================== The carrier_percentage module of the Tryton application platform. -See __tryton__.py Installing ---------- diff --git a/__tryton__.py b/__tryton__.py deleted file mode 100644 index 7df44c18b9..0000000000 --- a/__tryton__.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -#This file is part of Tryton. The COPYRIGHT file at the top level of -#this repository contains the full copyright notices and license terms. -{ - 'name': 'Carrier Percentage', - 'name_bg_BG': 'Управление на превозвачи: проценти', - 'name_ca_ES': 'Transportistes: Percentatge', - 'name_de_DE': 'Frachtkosten Prozentsatz', - 'name_fr_FR': 'Coût transporteur: pourcentage', - 'name_es_AR': 'Transportistas: Porcentaje', - 'name_es_ES': 'Transportistas: Porcentaje', - 'version': '2.5.0', - 'author': 'B2CK', - 'email': 'info@b2ck.com', - 'website': 'http://www.tryton.org/', - 'description': 'Add cost method based on percentage', - 'description_ca_ES': 'Afegeix mètode de cost basat en percentatge.', - 'description_de_DE': ''' - - Fügt eine Kostenmethode basierend auf Prozentsatz hinzu. - ''', - 'description_fr_FR': 'Ajoute une méthode de coût basée sur le pourcentage.', - 'description_es_AR': 'Añade método de costo basado en porcentaje', - 'description_es_ES': 'Añade método de coste basado en porcentaje.', - 'depends': [ - 'ir', - 'res', - 'carrier', - 'currency', - ], - 'extras_depend': [ - 'purchase_shipment_cost', - 'sale_shipment_cost', - ], - 'xml': [ - 'carrier.xml', - ], - 'translation': [ - 'locale/bg_BG.po', - 'locale/ca_ES.po', - 'locale/cs_CZ.po', - 'locale/de_DE.po', - 'locale/fr_FR.po', - 'locale/es_AR.po', - 'locale/es_ES.po', - 'locale/es_CO.po', - 'locale/nl_NL.po', - 'locale/ru_RU.po', - ], - } diff --git a/setup.py b/setup.py index 7d94013cde..aa3a52da36 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,19 @@ from setuptools import setup import re +import os +import ConfigParser -info = eval(open('__tryton__.py').read()) + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read() + +config = ConfigParser.ConfigParser() +config.readfp(open('tryton.cfg')) +info = dict(config.items('tryton')) +for key in ('depends', 'extras_depend', 'xml'): + if key in info: + info[key] = info[key].strip().splitlines() major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2) major_version = int(major_version) minor_version = int(minor_version) @@ -21,21 +32,21 @@ requires.append('trytond >= %s.%s, < %s.%s' % setup(name='trytond_carrier_percentage', version=info.get('version', '0.0.1'), - description=info.get('description', ''), - author=info.get('author', ''), - author_email=info.get('email', ''), - url=info.get('website', ''), + description='Tryton module to add cost method "on percentage" on carrier', + long_description=read('README'), + author='Tryton', + url='http://www.tryton.org/', download_url="http://downloads.tryton.org/" + \ info.get('version', '0.0.1').rsplit('.', 1)[0] + '/', package_dir={'trytond.modules.carrier_percentage': '.'}, packages=[ 'trytond.modules.carrier_percentage', 'trytond.modules.carrier_percentage.tests', - ], + ], package_data={ 'trytond.modules.carrier_percentage': info.get('xml', []) \ - + info.get('translation', []), - }, + + ['tryton.cfg', 'locale/*.po'], + }, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Plugins', @@ -57,11 +68,9 @@ setup(name='trytond_carrier_percentage', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Office/Business', - ], + ], license='GPL-3', install_requires=requires, - extras_require={ - }, zip_safe=False, entry_points=""" [trytond.modules] @@ -69,4 +78,4 @@ setup(name='trytond_carrier_percentage', """, test_suite='tests', test_loader='trytond.test_loader:Loader', -) + ) diff --git a/tryton.cfg b/tryton.cfg new file mode 100644 index 0000000000..3708ff0e4c --- /dev/null +++ b/tryton.cfg @@ -0,0 +1,12 @@ +[tryton] +version=2.5.0 +depends: + carrier + currency + ir + res +extras_depend: + purchase_shipment_cost + sale_shipment_cost +xml: + carrier.xml