[PATCH 1 of 2 pybill] Use new layout

Nsukami Patrick ptrck at nskm.xyz
Mon Sep 9 17:40:44 CEST 2019


# HG changeset patch
# User Nsukami Patrick <ndkpatt at gmail dot com>
# Date 1568037665 0
#      Mon Sep 09 14:01:05 2019 +0000
# Node ID e290fe581aee60d44043af9f40ee08b67cbfbaa6
# Parent  f20fda6a4522486a61d70cb74d26370f2d15d309
Use new layout

- move package files to pybill directory
- update setup.py, MANIIFEST.in, __pkgnfo__.py

diff --git a/MANIFEST.in b/MANIFEST.in
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -3,11 +3,13 @@
 include README
 include bin/pybill
 include bin/pybill.bat
-include man/pybill.1
-include xmlschema/*.xsd
-include configs/*.xml 
-include configs/README
-recursive-include examples *.py *.png *.xml README
+include pybill/man/pybill.1
+include pybill/xmlschema/*.xsd
+include pybill/configs/*.xml 
+include pybill/configs/README
+include pybill/*.py
+
+recursive-include pybill/examples *.py *.png *.xml README
 recursive-include test/data *
 recursive-include doc/_themes *
 recursive-include doc *.rst makefile README conf.py
diff --git a/__init__.py b/pybill/__init__.py
rename from __init__.py
rename to pybill/__init__.py
diff --git a/__pkginfo__.py b/pybill/__pkginfo__.py
rename from __pkginfo__.py
rename to pybill/__pkginfo__.py
--- a/__pkginfo__.py
+++ b/pybill/__pkginfo__.py
@@ -1,52 +1,56 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2001-2011 LOGILAB S.A. (Paris, FRANCE). All rights Reserved.
-# http://www.logilab.fr/ -- mailto:contact at logilab.fr
-"""
-PyBill packaging information
-"""
-from os import path as osp
+# copyright 2003-2019 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact at logilab.fr
+#
+# This file is part of logilab-doctools.
+#
+# logilab-doctools 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.
+#
+# logilab-doctools 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 logilab-doctools.  If not, see <http://www.gnu.org/licenses/>.
+"""PyBill packaging information"""
+__docformat__ = "restructuredtext en"
 
+from os.path import join
 
-# package name
+distname = 'pybill'
 modname = 'pybill'
 debian_name = 'pybill'
 
-# release version
 numversion = (1, 1, 0)
 version = '.'.join([str(num) for num in numversion])
-
-pyversions = ['2.4','2.5', '2.6']
-
-# license and copyright
-license = "GPL"
-copyright = """Copyright (c) 2001-2011 LOGILAB S.A. (Paris, FRANCE). All rights Reserved.
-http://www.logilab.fr/ -- mailto:contact at logilab.fr"""
+pyversions = ['2.7', '3.6']
 
-# short and long description
-short_desc = "PDF formatting tool for bills"
-try:
-    long_desc = open(osp.join(osp.abspath(osp.dirname(__file__)), "README")).read()
-except Exception, exc:
-    long_desc = short_desc
-
-# author name and email
+license = 'LGPL'
+description = "PDF formatting tool for bills"
+mailinglist = "mailto://python-projects@lists.logilab.org"
+web = "http://www.logilab.org/project/%s" % distname
 author = "Olivier Cayrol"
 author_email = "olivier.cayrol at logilab.fr"
 
-# home page
-web = "http://www.logilab.org/project/pybill"
+# executable (include the 'bin' directory in the name)
 
-# mailing list
-mailinglist = 'mail-to://management-projects@lists.logilab.org' 
-
-# download place
-ftp = "ftp://ftp.logilab.org/pub/%s" % modname
+scripts = [join('bin', name)
+           for name in ('pybill',)]
 
-# executable (include the 'bin' directory in the name)
-scripts = ('bin/pybill',)
+install_requires = [
+    'setuptools',
+    'six >= 1.4.0',
+    'reportlab',
+    'docutils',
+    'lxml',
+    'logilab-common',
+]
 
-# should it be placed as a subpackage of a package such as 'logilab'
-subpackage_of = None
-
-# is there some directories to include with the source installation
-include_dirs = []
+classifiers = ["Topic :: Utilities",
+               "Programming Language :: Python",
+               "Programming Language :: Python :: 2",
+               "Programming Language :: Python :: 3",
+               ]
diff --git a/commandline/__init__.py b/pybill/commandline/__init__.py
rename from commandline/__init__.py
rename to pybill/commandline/__init__.py
diff --git a/commandline/ui.py b/pybill/commandline/ui.py
rename from commandline/ui.py
rename to pybill/commandline/ui.py
diff --git a/configs/README b/pybill/configs/README
rename from configs/README
rename to pybill/configs/README
diff --git a/configs/default.xml b/pybill/configs/default.xml
rename from configs/default.xml
rename to pybill/configs/default.xml
diff --git a/examples/configs/config-en.xml b/pybill/examples/configs/config-en.xml
rename from examples/configs/config-en.xml
rename to pybill/examples/configs/config-en.xml
diff --git a/examples/configs/config-fr.xml b/pybill/examples/configs/config-fr.xml
rename from examples/configs/config-fr.xml
rename to pybill/examples/configs/config-fr.xml
diff --git a/examples/genexamples.py b/pybill/examples/genexamples.py
rename from examples/genexamples.py
rename to pybill/examples/genexamples.py
diff --git a/examples/inputs/01_bill-simple.xml b/pybill/examples/inputs/01_bill-simple.xml
rename from examples/inputs/01_bill-simple.xml
rename to pybill/examples/inputs/01_bill-simple.xml
diff --git a/examples/inputs/02_bill-with-details.xml b/pybill/examples/inputs/02_bill-with-details.xml
rename from examples/inputs/02_bill-with-details.xml
rename to pybill/examples/inputs/02_bill-with-details.xml
diff --git a/examples/inputs/03_bill-with-remarks.xml b/pybill/examples/inputs/03_bill-with-remarks.xml
rename from examples/inputs/03_bill-with-remarks.xml
rename to pybill/examples/inputs/03_bill-with-remarks.xml
diff --git a/examples/inputs/04_bill-with-various-vat-rates.xml b/pybill/examples/inputs/04_bill-with-various-vat-rates.xml
rename from examples/inputs/04_bill-with-various-vat-rates.xml
rename to pybill/examples/inputs/04_bill-with-various-vat-rates.xml
diff --git a/examples/inputs/05_bill-with-no-vat.xml b/pybill/examples/inputs/05_bill-with-no-vat.xml
rename from examples/inputs/05_bill-with-no-vat.xml
rename to pybill/examples/inputs/05_bill-with-no-vat.xml
diff --git a/examples/inputs/06_bill_with-vat-and-no-vat.xml b/pybill/examples/inputs/06_bill_with-vat-and-no-vat.xml
rename from examples/inputs/06_bill_with-vat-and-no-vat.xml
rename to pybill/examples/inputs/06_bill_with-vat-and-no-vat.xml
diff --git a/examples/inputs/07_bill-with-holdback.xml b/pybill/examples/inputs/07_bill-with-holdback.xml
rename from examples/inputs/07_bill-with-holdback.xml
rename to pybill/examples/inputs/07_bill-with-holdback.xml
diff --git a/examples/inputs/08_bill-with-holdback-on-vat.xml b/pybill/examples/inputs/08_bill-with-holdback-on-vat.xml
rename from examples/inputs/08_bill-with-holdback-on-vat.xml
rename to pybill/examples/inputs/08_bill-with-holdback-on-vat.xml
diff --git a/examples/inputs/09_bill-with-both-holdbacks.xml b/pybill/examples/inputs/09_bill-with-both-holdbacks.xml
rename from examples/inputs/09_bill-with-both-holdbacks.xml
rename to pybill/examples/inputs/09_bill-with-both-holdbacks.xml
diff --git a/examples/inputs/10_bill-total-on-page-2.xml b/pybill/examples/inputs/10_bill-total-on-page-2.xml
rename from examples/inputs/10_bill-total-on-page-2.xml
rename to pybill/examples/inputs/10_bill-total-on-page-2.xml
diff --git a/examples/inputs/11_bill-two-pages.xml b/pybill/examples/inputs/11_bill-two-pages.xml
rename from examples/inputs/11_bill-two-pages.xml
rename to pybill/examples/inputs/11_bill-two-pages.xml
diff --git a/examples/inputs/12_debit-simple.xml b/pybill/examples/inputs/12_debit-simple.xml
rename from examples/inputs/12_debit-simple.xml
rename to pybill/examples/inputs/12_debit-simple.xml
diff --git a/examples/inputs/13_debit-with-no-vat.xml b/pybill/examples/inputs/13_debit-with-no-vat.xml
rename from examples/inputs/13_debit-with-no-vat.xml
rename to pybill/examples/inputs/13_debit-with-no-vat.xml
diff --git a/examples/inputs/14_debit-with-no-payment-terms.xml b/pybill/examples/inputs/14_debit-with-no-payment-terms.xml
rename from examples/inputs/14_debit-with-no-payment-terms.xml
rename to pybill/examples/inputs/14_debit-with-no-payment-terms.xml
diff --git a/examples/inputs/15_downpayment-simple.xml b/pybill/examples/inputs/15_downpayment-simple.xml
rename from examples/inputs/15_downpayment-simple.xml
rename to pybill/examples/inputs/15_downpayment-simple.xml
diff --git a/examples/inputs/16_downpayment-with-percent.xml b/pybill/examples/inputs/16_downpayment-with-percent.xml
rename from examples/inputs/16_downpayment-with-percent.xml
rename to pybill/examples/inputs/16_downpayment-with-percent.xml
diff --git a/examples/inputs/17_downpayment-with-no-vat.xml b/pybill/examples/inputs/17_downpayment-with-no-vat.xml
rename from examples/inputs/17_downpayment-with-no-vat.xml
rename to pybill/examples/inputs/17_downpayment-with-no-vat.xml
diff --git a/examples/inputs/18_bill-with-debit.xml b/pybill/examples/inputs/18_bill-with-debit.xml
rename from examples/inputs/18_bill-with-debit.xml
rename to pybill/examples/inputs/18_bill-with-debit.xml
diff --git a/examples/inputs/19_bill-with-downpayment.xml b/pybill/examples/inputs/19_bill-with-downpayment.xml
rename from examples/inputs/19_bill-with-downpayment.xml
rename to pybill/examples/inputs/19_bill-with-downpayment.xml
diff --git a/examples/inputs/20_pro-forma-simple.xml b/pybill/examples/inputs/20_pro-forma-simple.xml
rename from examples/inputs/20_pro-forma-simple.xml
rename to pybill/examples/inputs/20_pro-forma-simple.xml
diff --git a/examples/inputs/21_pro-forma-with-no-vat.xml b/pybill/examples/inputs/21_pro-forma-with-no-vat.xml
rename from examples/inputs/21_pro-forma-with-no-vat.xml
rename to pybill/examples/inputs/21_pro-forma-with-no-vat.xml
diff --git a/examples/inputs/22_claim-form-simple.xml b/pybill/examples/inputs/22_claim-form-simple.xml
rename from examples/inputs/22_claim-form-simple.xml
rename to pybill/examples/inputs/22_claim-form-simple.xml
diff --git a/examples/inputs/23_claim-form-with-vat.xml b/pybill/examples/inputs/23_claim-form-with-vat.xml
rename from examples/inputs/23_claim-form-with-vat.xml
rename to pybill/examples/inputs/23_claim-form-with-vat.xml
diff --git a/examples/inputs/24_bill-with-qty-digits.xml b/pybill/examples/inputs/24_bill-with-qty-digits.xml
rename from examples/inputs/24_bill-with-qty-digits.xml
rename to pybill/examples/inputs/24_bill-with-qty-digits.xml
diff --git a/examples/inputs/25_bill-with-price-digits.xml b/pybill/examples/inputs/25_bill-with-price-digits.xml
rename from examples/inputs/25_bill-with-price-digits.xml
rename to pybill/examples/inputs/25_bill-with-price-digits.xml
diff --git a/examples/logos/mpe.png b/pybill/examples/logos/mpe.png
rename from examples/logos/mpe.png
rename to pybill/examples/logos/mpe.png
diff --git a/examples/results/README b/pybill/examples/results/README
rename from examples/results/README
rename to pybill/examples/results/README
diff --git a/history/dtd-format-0.1/catalog b/pybill/history/dtd-format-0.1/catalog
rename from history/dtd-format-0.1/catalog
rename to pybill/history/dtd-format-0.1/catalog
diff --git a/history/dtd-format-0.1/config.dtd b/pybill/history/dtd-format-0.1/config.dtd
rename from history/dtd-format-0.1/config.dtd
rename to pybill/history/dtd-format-0.1/config.dtd
diff --git a/history/dtd-format-0.1/pybill.dtd b/pybill/history/dtd-format-0.1/pybill.dtd
rename from history/dtd-format-0.1/pybill.dtd
rename to pybill/history/dtd-format-0.1/pybill.dtd
diff --git a/lib/__init__.py b/pybill/lib/__init__.py
rename from lib/__init__.py
rename to pybill/lib/__init__.py
diff --git a/lib/accounting/__init__.py b/pybill/lib/accounting/__init__.py
rename from lib/accounting/__init__.py
rename to pybill/lib/accounting/__init__.py
diff --git a/lib/accounting/generator.py b/pybill/lib/accounting/generator.py
rename from lib/accounting/generator.py
rename to pybill/lib/accounting/generator.py
diff --git a/lib/accounting/utils.py b/pybill/lib/accounting/utils.py
rename from lib/accounting/utils.py
rename to pybill/lib/accounting/utils.py
diff --git a/lib/config/__init__.py b/pybill/lib/config/__init__.py
rename from lib/config/__init__.py
rename to pybill/lib/config/__init__.py
diff --git a/lib/config/entities.py b/pybill/lib/config/entities.py
rename from lib/config/entities.py
rename to pybill/lib/config/entities.py
diff --git a/lib/config/register.py b/pybill/lib/config/register.py
rename from lib/config/register.py
rename to pybill/lib/config/register.py
diff --git a/lib/config/xmlreaders.py b/pybill/lib/config/xmlreaders.py
rename from lib/config/xmlreaders.py
rename to pybill/lib/config/xmlreaders.py
diff --git a/lib/config/xmlwriters.py b/pybill/lib/config/xmlwriters.py
rename from lib/config/xmlwriters.py
rename to pybill/lib/config/xmlwriters.py
diff --git a/lib/controller.py b/pybill/lib/controller.py
rename from lib/controller.py
rename to pybill/lib/controller.py
diff --git a/lib/entities/__init__.py b/pybill/lib/entities/__init__.py
rename from lib/entities/__init__.py
rename to pybill/lib/entities/__init__.py
diff --git a/lib/entities/accounting_docs/__init__.py b/pybill/lib/entities/accounting_docs/__init__.py
rename from lib/entities/accounting_docs/__init__.py
rename to pybill/lib/entities/accounting_docs/__init__.py
diff --git a/lib/entities/accounting_docs/abstract.py b/pybill/lib/entities/accounting_docs/abstract.py
rename from lib/entities/accounting_docs/abstract.py
rename to pybill/lib/entities/accounting_docs/abstract.py
diff --git a/lib/entities/accounting_docs/bill.py b/pybill/lib/entities/accounting_docs/bill.py
rename from lib/entities/accounting_docs/bill.py
rename to pybill/lib/entities/accounting_docs/bill.py
diff --git a/lib/entities/accounting_docs/claimform.py b/pybill/lib/entities/accounting_docs/claimform.py
rename from lib/entities/accounting_docs/claimform.py
rename to pybill/lib/entities/accounting_docs/claimform.py
diff --git a/lib/entities/accounting_docs/debit.py b/pybill/lib/entities/accounting_docs/debit.py
rename from lib/entities/accounting_docs/debit.py
rename to pybill/lib/entities/accounting_docs/debit.py
diff --git a/lib/entities/accounting_docs/downpayment.py b/pybill/lib/entities/accounting_docs/downpayment.py
rename from lib/entities/accounting_docs/downpayment.py
rename to pybill/lib/entities/accounting_docs/downpayment.py
diff --git a/lib/entities/accounting_docs/proforma.py b/pybill/lib/entities/accounting_docs/proforma.py
rename from lib/entities/accounting_docs/proforma.py
rename to pybill/lib/entities/accounting_docs/proforma.py
diff --git a/lib/entities/accounting_docs/utils.py b/pybill/lib/entities/accounting_docs/utils.py
rename from lib/entities/accounting_docs/utils.py
rename to pybill/lib/entities/accounting_docs/utils.py
diff --git a/lib/entities/addresses.py b/pybill/lib/entities/addresses.py
rename from lib/entities/addresses.py
rename to pybill/lib/entities/addresses.py
diff --git a/lib/errors.py b/pybill/lib/errors.py
rename from lib/errors.py
rename to pybill/lib/errors.py
diff --git a/lib/pdfwriters/__init__.py b/pybill/lib/pdfwriters/__init__.py
rename from lib/pdfwriters/__init__.py
rename to pybill/lib/pdfwriters/__init__.py
diff --git a/lib/pdfwriters/flowgenerators/__init__.py b/pybill/lib/pdfwriters/flowgenerators/__init__.py
rename from lib/pdfwriters/flowgenerators/__init__.py
rename to pybill/lib/pdfwriters/flowgenerators/__init__.py
diff --git a/lib/pdfwriters/flowgenerators/abstract.py b/pybill/lib/pdfwriters/flowgenerators/abstract.py
rename from lib/pdfwriters/flowgenerators/abstract.py
rename to pybill/lib/pdfwriters/flowgenerators/abstract.py
diff --git a/lib/pdfwriters/flowgenerators/bill_generator.py b/pybill/lib/pdfwriters/flowgenerators/bill_generator.py
rename from lib/pdfwriters/flowgenerators/bill_generator.py
rename to pybill/lib/pdfwriters/flowgenerators/bill_generator.py
diff --git a/lib/pdfwriters/flowgenerators/claimform_generator.py b/pybill/lib/pdfwriters/flowgenerators/claimform_generator.py
rename from lib/pdfwriters/flowgenerators/claimform_generator.py
rename to pybill/lib/pdfwriters/flowgenerators/claimform_generator.py
diff --git a/lib/pdfwriters/flowgenerators/debit_generator.py b/pybill/lib/pdfwriters/flowgenerators/debit_generator.py
rename from lib/pdfwriters/flowgenerators/debit_generator.py
rename to pybill/lib/pdfwriters/flowgenerators/debit_generator.py
diff --git a/lib/pdfwriters/flowgenerators/downpayment_generator.py b/pybill/lib/pdfwriters/flowgenerators/downpayment_generator.py
rename from lib/pdfwriters/flowgenerators/downpayment_generator.py
rename to pybill/lib/pdfwriters/flowgenerators/downpayment_generator.py
diff --git a/lib/pdfwriters/flowgenerators/proforma_generator.py b/pybill/lib/pdfwriters/flowgenerators/proforma_generator.py
rename from lib/pdfwriters/flowgenerators/proforma_generator.py
rename to pybill/lib/pdfwriters/flowgenerators/proforma_generator.py
diff --git a/lib/pdfwriters/templates/__init__.py b/pybill/lib/pdfwriters/templates/__init__.py
rename from lib/pdfwriters/templates/__init__.py
rename to pybill/lib/pdfwriters/templates/__init__.py
diff --git a/lib/pdfwriters/templates/doc_templates.py b/pybill/lib/pdfwriters/templates/doc_templates.py
rename from lib/pdfwriters/templates/doc_templates.py
rename to pybill/lib/pdfwriters/templates/doc_templates.py
diff --git a/lib/pdfwriters/templates/page_templates.py b/pybill/lib/pdfwriters/templates/page_templates.py
rename from lib/pdfwriters/templates/page_templates.py
rename to pybill/lib/pdfwriters/templates/page_templates.py
diff --git a/lib/pdfwriters/utils.py b/pybill/lib/pdfwriters/utils.py
rename from lib/pdfwriters/utils.py
rename to pybill/lib/pdfwriters/utils.py
diff --git a/lib/pdfwriters/writers.py b/pybill/lib/pdfwriters/writers.py
rename from lib/pdfwriters/writers.py
rename to pybill/lib/pdfwriters/writers.py
diff --git a/lib/xmlreaders/__init__.py b/pybill/lib/xmlreaders/__init__.py
rename from lib/xmlreaders/__init__.py
rename to pybill/lib/xmlreaders/__init__.py
diff --git a/lib/xmlreaders/accdoc.py b/pybill/lib/xmlreaders/accdoc.py
rename from lib/xmlreaders/accdoc.py
rename to pybill/lib/xmlreaders/accdoc.py
diff --git a/lib/xmlreaders/accdoc_format_0_X.py b/pybill/lib/xmlreaders/accdoc_format_0_X.py
rename from lib/xmlreaders/accdoc_format_0_X.py
rename to pybill/lib/xmlreaders/accdoc_format_0_X.py
diff --git a/lib/xmlreaders/accdoc_format_1_0.py b/pybill/lib/xmlreaders/accdoc_format_1_0.py
rename from lib/xmlreaders/accdoc_format_1_0.py
rename to pybill/lib/xmlreaders/accdoc_format_1_0.py
diff --git a/lib/xmlreaders/utils.py b/pybill/lib/xmlreaders/utils.py
rename from lib/xmlreaders/utils.py
rename to pybill/lib/xmlreaders/utils.py
diff --git a/lib/xmlwriters/__init__.py b/pybill/lib/xmlwriters/__init__.py
rename from lib/xmlwriters/__init__.py
rename to pybill/lib/xmlwriters/__init__.py
diff --git a/lib/xmlwriters/accdoc.py b/pybill/lib/xmlwriters/accdoc.py
rename from lib/xmlwriters/accdoc.py
rename to pybill/lib/xmlwriters/accdoc.py
diff --git a/lib/xmlwriters/accdoc_format_1_0.py b/pybill/lib/xmlwriters/accdoc_format_1_0.py
rename from lib/xmlwriters/accdoc_format_1_0.py
rename to pybill/lib/xmlwriters/accdoc_format_1_0.py
diff --git a/lib/xmlwriters/utils.py b/pybill/lib/xmlwriters/utils.py
rename from lib/xmlwriters/utils.py
rename to pybill/lib/xmlwriters/utils.py
diff --git a/main.py b/pybill/main.py
rename from main.py
rename to pybill/main.py
diff --git a/man/pybill.1 b/pybill/man/pybill.1
rename from man/pybill.1
rename to pybill/man/pybill.1
diff --git a/xmlschema/pybill-config-1_0.xsd b/pybill/xmlschema/pybill-config-1_0.xsd
rename from xmlschema/pybill-config-1_0.xsd
rename to pybill/xmlschema/pybill-config-1_0.xsd
diff --git a/xmlschema/pybill-document-1_0.xsd b/pybill/xmlschema/pybill-document-1_0.xsd
rename from xmlschema/pybill-document-1_0.xsd
rename to pybill/xmlschema/pybill-document-1_0.xsd
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,213 +1,50 @@
 #!/usr/bin/env python
-# pylint: disable-msg=W0404,W0622,W0704,W0613,W0152
-"""Generic Setup script, takes package info from __pkginfo__.py file.
 
-:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
-:contact: http://www.logilab.fr/ -- mailto:contact at logilab.fr
-:license: General Public License version 2 - http://www.gnu.org/licenses
+# pylint: disable=W0404,W0622,W0704,W0613,W0152
+# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr/ -- mailto:contact at logilab.fr
+#
+# This file is part of logilab-pybill.
+#
+# logilab-pybill 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.
+#
+# logilab-pybill 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 logilab-pybill.  If not, see <http://www.gnu.org/licenses/>.
+"""Generic Setup script, takes package info from __pkginfo__.py file.
 """
 __docformat__ = "restructuredtext en"
 
-import os
-import sys
-import shutil
-from os.path import isdir, exists, join, walk
+from setuptools import setup
+from io import open
+from os import path
 
-try:
-    if os.environ.get('NO_SETUPTOOLS'):
-        raise ImportError()
-    from setuptools import setup
-    from setuptools.command import install_lib
-    USE_SETUPTOOLS = 1
-except ImportError:
-    from distutils.core import setup
-    from distutils.command import install_lib
-    USE_SETUPTOOLS = 0
-
+here = path.dirname(__file__)
 
-sys.modules.pop('__pkginfo__', None)
-# import required features
-from __pkginfo__ import modname, version, license, short_desc, long_desc, \
-     web, author, author_email
-# import optional features
-try:
-    from __pkginfo__ import distname
-except ImportError:
-    distname = modname
-try:
-    from __pkginfo__ import scripts
-except ImportError:
-    scripts = []
-try:
-    from __pkginfo__ import data_files
-except ImportError:
-    data_files = None
-try:
-    from __pkginfo__ import subpackage_of
-except ImportError:
-    subpackage_of = None
-try:
-    from __pkginfo__ import include_dirs
-except ImportError:
-    include_dirs = []
-try:
-    from __pkginfo__ import ext_modules
-except ImportError:
-    ext_modules = None
-try:
-    from __pkginfo__ import install_requires
-except ImportError:
-    install_requires = None
+pkginfo = {}
+with open(path.join(here, 'pybill', '__pkginfo__.py')) as f:
+    exec(f.read(), pkginfo)
 
-STD_BLACKLIST = ('CVS', '.svn', '.hg', 'debian', 'dist', 'build')
-
-IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc', '~')
-
-
-
-def ensure_scripts(linux_scripts):
-    """
-    Creates the proper script names required for each platform
-    (taken from 4Suite)
-    """
-    from distutils import util
-    if util.get_platform()[:3] == 'win':
-        scripts_ = [script + '.bat' for script in linux_scripts]
-    else:
-        scripts_ = linux_scripts
-    return scripts_
-
-
-def get_packages(directory, prefix):
-    """return a list of subpackages for the given directory
-    """
-    result = []
-    for package in os.listdir(directory):
-        absfile = join(directory, package)
-        if isdir(absfile):
-            if exists(join(absfile, '__init__.py')) or \
-                   package in ('test', 'tests'):
-                if prefix:
-                    result.append('%s.%s' % (prefix, package))
-                else:
-                    result.append(package)
-                result += get_packages(absfile, result[-1])
-    return result
+with open(path.join(here, 'README'), encoding='utf-8') as f:
+    long_description = f.read()
 
-def export(from_dir, to_dir,
-           blacklist=STD_BLACKLIST,
-           ignore_ext=IGNORED_EXTENSIONS,
-           verbose=True):
-    """make a mirror of from_dir in to_dir, omitting directories and files
-    listed in the black list
-    """
-    def make_mirror(arg, directory, fnames):
-        """walk handler"""
-        for norecurs in blacklist:
-            try:
-                fnames.remove(norecurs)
-            except ValueError:
-                pass
-        for filename in fnames:
-            # don't include binary files
-            if filename[-4:] in ignore_ext:
-                continue
-            if filename[-1] == '~':
-                continue
-            src = join(directory, filename)
-            dest = to_dir + src[len(from_dir):]
-            if verbose:
-                print >> sys.stderr, src, '->', dest
-            if os.path.isdir(src):
-                if not exists(dest):
-                    os.mkdir(dest)
-            else:
-                if exists(dest):
-                    os.remove(dest)
-                shutil.copy2(src, dest)
-    try:
-        os.mkdir(to_dir)
-    except OSError, ex:
-        # file exists ?
-        import errno
-        if ex.errno != errno.EEXIST:
-            raise
-    walk(from_dir, make_mirror, None)
-
-
-EMPTY_FILE = '''"""generated file, don\'t modify or your data will be lost"""
-try:
-    __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
-    pass
-'''
-
-class MyInstallLib(install_lib.install_lib):
-    """extend install_lib command to handle  package __init__.py and
-    include_dirs variable if necessary
-    """
-    def run(self):
-        """overridden from install_lib class"""
-        install_lib.install_lib.run(self)
-        # create Products.__init__.py if needed
-        if subpackage_of:
-            product_init = join(self.install_dir, subpackage_of, '__init__.py')
-            if not exists(product_init):
-                self.announce('creating %s' % product_init)
-                stream = open(product_init, 'w')
-                stream.write(EMPTY_FILE)
-                stream.close()
-        # manually install included directories if any
-        if include_dirs:
-            if subpackage_of:
-                base = join(subpackage_of, modname)
-            else:
-                base = modname
-            for directory in include_dirs:
-                dest = join(self.install_dir, base, directory)
-                export(directory, dest, verbose=False)
-
-def install(**kwargs):
-    """setup entry point"""
-    try:
-        if USE_SETUPTOOLS:
-            sys.argv.remove('--force-manifest')
-    except:
-        pass
-    try:
-        if not USE_SETUPTOOLS:
-            from distutils import __version__ as distutils_version
-            if tuple([int(x) for x in distutils_version.split('.')]) <= (2, 5, 1):
-                sys.argv.remove('--install-layout=deb')
-                print "W: remove '--install-layout=deb' option"
-    except:
-        pass
-    if subpackage_of:
-        package = subpackage_of + '.' + modname
-        kwargs['package_dir'] = {package : '.'}
-        packages = [package] + get_packages(os.getcwd(), package)
-        if USE_SETUPTOOLS:
-            kwargs['namespace_packages'] = [subpackage_of]
-    else:
-        kwargs['package_dir'] = {modname : '.'}
-        packages = [modname] + get_packages(os.getcwd(), modname)
-    if USE_SETUPTOOLS and install_requires:
-        kwargs['install_requires'] = install_requires
-    kwargs['packages'] = packages
-    return setup(name = distname,
-                 version = version,
-                 license = license,
-                 description = short_desc,
-                 long_description = long_desc,
-                 author = author,
-                 author_email = author_email,
-                 url = web,
-                 scripts = ensure_scripts(scripts),
-                 data_files = data_files,
-                 ext_modules = ext_modules,
-                 cmdclass = {'install_lib': MyInstallLib},
-                 **kwargs
-                 )
-
-if __name__ == '__main__' :
-    install()
+setup(
+    name=pkginfo['distname'],
+    version=pkginfo['version'],
+    description=pkginfo['description'],
+    long_description=long_description,
+    url=pkginfo['web'],
+    author=pkginfo['author'],
+    author_email=pkginfo['author_email'],
+    install_requires=pkginfo['install_requires'],
+    license=pkginfo['license'],
+    classifiers=pkginfo['classifiers'],
+    scripts=pkginfo['scripts'],
+)



More information about the cubicweb-devel mailing list