summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis de Lattre <alexis.delattre@akretion.com>2019-01-25 20:12:57 (GMT)
committerAlexis de Lattre <alexis.delattre@akretion.com>2019-01-25 20:12:57 (GMT)
commit9168806e3403260485c52ad305a20c00398a9e69 (patch)
tree5729d891c2b1959845465012a715bab82188ff67
parent649f25006f7b776b3246fd7536f699eb1c5dfa08 (diff)
downloadfactur-x-9168806e3403260485c52ad305a20c00398a9e69.zip
factur-x-9168806e3403260485c52ad305a20c00398a9e69.tar.gz
factur-x-9168806e3403260485c52ad305a20c00398a9e69.tar.bz2
Prepare 0.9 release
Add debug logs PEP8 stuff
-rw-r--r--README.rst18
-rwxr-xr-xbin/facturx-pdfextractxml2
-rwxr-xr-xbin/facturx-pdfgen2
-rwxr-xr-xbin/facturx-xmlcheck2
-rw-r--r--facturx/_version.py2
-rw-r--r--facturx/facturx.py20
-rw-r--r--setup.py1
7 files changed, 34 insertions, 13 deletions
diff --git a/README.rst b/README.rst
index 96304ed..2f4a8d2 100644
--- a/README.rst
+++ b/README.rst
@@ -1,7 +1,7 @@
Factur-X Python library
=======================
-Factur-X is the e-invoicing standard for France and Germany. The Factur-X specifications are available on the `FNFE-MPE website <http://fnfe-mpe.org/factur-x/>`_. The Factur-X standard is also called ZUGFeRD 2.0 in Germany.
+Factur-X is the e-invoicing standard for France and Germany. The Factur-X specifications are available on the `FNFE-MPE website <http://fnfe-mpe.org/factur-x/>`_ in English and French. The Factur-X standard is also called ZUGFeRD 2.0 in Germany.
The main feature of this Python library is to generate Factur-X invoices from a regular PDF invoice and a Factur-X compliant XML file.
@@ -15,10 +15,19 @@ Some of the features provided by this lib also work for ZUGFeRD 1.0 (the ancesto
Installation
============
+This library works both on python 2.7 and python 3.
+
+To install it for python 3, run:
+
.. code::
- sudo pip install --upgrade factur-x
+ sudo pip3 install --upgrade factur-x
+To install it for python 2.7, run:
+
+.. code::
+
+ sudo pip install --upgrade factur-x
Usage
=====
@@ -56,6 +65,11 @@ Contributors
Changelog
=========
+* Version 0.9 dated 2019-01-25
+
+ * Port to python 3 contributed by JoshuaJan (https://github.com/joshuajan)
+ * Fix path to ZUGFeRD 1.0 XSD
+
* Version 0.8 dated 2018-06-10
* Make pretty_print work for XMP file, for better readability of that file
diff --git a/bin/facturx-pdfextractxml b/bin/facturx-pdfextractxml
index 439650e..65322cf 100755
--- a/bin/facturx-pdfextractxml
+++ b/bin/facturx-pdfextractxml
@@ -1,6 +1,6 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
-# © 2017 Alexis de Lattre <alexis.delattre@akretion.com>
+# Copyright 2017-2019 Alexis de Lattre <alexis.delattre@akretion.com>
from optparse import OptionParser
import sys
diff --git a/bin/facturx-pdfgen b/bin/facturx-pdfgen
index afd5e00..80e3975 100755
--- a/bin/facturx-pdfgen
+++ b/bin/facturx-pdfgen
@@ -1,6 +1,6 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
-# © 2017 Alexis de Lattre <alexis.delattre@akretion.com>
+# Copyright 2017-2019 Alexis de Lattre <alexis.delattre@akretion.com>
from optparse import OptionParser
import sys
diff --git a/bin/facturx-xmlcheck b/bin/facturx-xmlcheck
index 6bbca71..af1b703 100755
--- a/bin/facturx-xmlcheck
+++ b/bin/facturx-xmlcheck
@@ -1,6 +1,6 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
-# © 2017 Alexis de Lattre <alexis.delattre@akretion.com>
+# Copyright 2017-2019 Alexis de Lattre <alexis.delattre@akretion.com>
from optparse import OptionParser
import sys
diff --git a/facturx/_version.py b/facturx/_version.py
index 376df7c..e46aee1 100644
--- a/facturx/_version.py
+++ b/facturx/_version.py
@@ -1 +1 @@
-__version__ = '0.8'
+__version__ = '0.9'
diff --git a/facturx/facturx.py b/facturx/facturx.py
index 1dc5557..4f88010 100644
--- a/facturx/facturx.py
+++ b/facturx/facturx.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Copyright 2016-2018, Alexis de Lattre <alexis.delattre@akretion.com>
+# Copyright 2016-2019, Alexis de Lattre <alexis.delattre@akretion.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# TODO list:
-# - have both python2 and python3 support
# - add automated tests (currently, we only have tests at odoo module level)
# - keep original metadata by copy of pdf_tailer[/Info] ?
@@ -43,6 +42,12 @@ import os.path
import mimetypes
import hashlib
import logging
+import sys
+if sys.version_info[0] == 3:
+ unicode = str
+ from io import IOBase
+ file = IOBase
+
FORMAT = '%(asctime)s [%(levelname)s] %(message)s'
logging.basicConfig(format=FORMAT)
@@ -63,11 +68,6 @@ FACTURX_LEVEL2xmp = {
'en16931': 'EN 16931',
}
-import sys
-if sys.version_info[0] == 3:
- unicode = str
- from io import IOBase
- file = IOBase
def check_facturx_xsd(
facturx_xml, flavor='autodetect', facturx_level='autodetect'):
@@ -84,6 +84,8 @@ def check_facturx_xsd(
:return: True if the XML is valid against the XSD
raise an error if it is not valid against the XSD
"""
+ logger.debug(
+ 'check_facturx_xsd with factur-x lib %s', __version__)
if not facturx_xml:
raise ValueError('Missing facturx_xml argument')
if not isinstance(flavor, (str, unicode)):
@@ -151,6 +153,8 @@ def check_facturx_xsd(
def get_facturx_xml_from_pdf(pdf_invoice, check_xsd=True):
+ logger.debug(
+ 'get_facturx_xml_from_pdf with factur-x lib %s', __version__)
if not pdf_invoice:
raise ValueError('Missing pdf_invoice argument')
if not isinstance(check_xsd, bool):
@@ -684,6 +688,8 @@ def generate_facturx_from_file(
:rtype: bool
"""
start_chrono = datetime.now()
+ logger.debug(
+ 'generate_facturx_from_file with factur-x lib %s', __version__)
logger.debug('1st arg pdf_invoice type=%s', type(pdf_invoice))
logger.debug('2nd arg facturx_xml type=%s', type(facturx_xml))
logger.debug('optional arg facturx_level=%s', facturx_level)
diff --git a/setup.py b/setup.py
index e607340..5cac074 100644
--- a/setup.py
+++ b/setup.py
@@ -26,6 +26,7 @@ setup(
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: BSD License',
"Operating System :: OS Independent",
],