From 9f3b26c1caf20e02b0a15fedb367c6a8268a1648 Mon Sep 17 00:00:00 2001
From: Simon Lejeune <sle@openerp.com>
Date: Thu, 30 Jul 2015 15:56:28 +0200
Subject: [PATCH] [REF] packaging: ofxparse as "hard" dependency

---
 .../account_bank_statement_import_ofx/__openerp__.py  |  3 ---
 .../account_bank_statement_import_ofx.py              | 11 ++---------
 debian/control                                        |  1 +
 requirements.txt                                      |  1 +
 setup.py                                              |  2 ++
 setup/package.dfcentos                                |  2 +-
 setup/package.dfdebian                                |  1 +
 setup/redhat/postinstall.sh                           |  2 +-
 8 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/addons/account_bank_statement_import_ofx/__openerp__.py b/addons/account_bank_statement_import_ofx/__openerp__.py
index fd800511594a..57fff5258a0e 100644
--- a/addons/account_bank_statement_import_ofx/__openerp__.py
+++ b/addons/account_bank_statement_import_ofx/__openerp__.py
@@ -17,7 +17,4 @@ creation of the Financial Accounting records).
     """,
     'installable': True,
     'auto_install': True,
-    'external_dependencies' : {
-        'python' : ['ofxparse'],
-    }
 }
diff --git a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
index 0a6855089ea0..f332cc184975 100644
--- a/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
+++ b/addons/account_bank_statement_import_ofx/account_bank_statement_import_ofx.py
@@ -5,24 +5,17 @@ import StringIO
 
 from openerp import api, models, _
 from openerp.exceptions import UserError
+from ofxparse import OfxParser
 
 _logger = logging.getLogger(__name__)
 
-try:
-    from ofxparse import OfxParser as ofxparser
-except ImportError:
-    _logger.warn("ofxparse not found, OFX parsing disabled.")
-    ofxparser = None
-
 
 class AccountBankStatementImport(models.TransientModel):
     _inherit = 'account.bank.statement.import'
 
     def _check_ofx(self, file):
-        if ofxparser is None:
-            return False
         try:
-            ofx = ofxparser.parse(file)
+            ofx = OfxParser.parse(file)
         except:
             return False
         return ofx
diff --git a/debian/control b/debian/control
index 45c9f530631d..e1e549b29f19 100644
--- a/debian/control
+++ b/debian/control
@@ -27,6 +27,7 @@ Depends:
  python-lxml,
  python-mako,
  python-mock,
+ python-ofxparse,
  python-openid,
  python-passlib,
  python-psutil,
diff --git a/requirements.txt b/requirements.txt
index ab1c1f3a1856..59e6663e68d2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,6 +16,7 @@ greenlet==0.4.5
 jcconv==0.2.3
 lxml==3.4.1
 mock==1.0.1
+ofxparse==0.14
 passlib==1.6.2
 psutil==2.2.0
 psycogreen==1.0
diff --git a/setup.py b/setup.py
index 27f170961d5e..d361fc61b707 100644
--- a/setup.py
+++ b/setup.py
@@ -81,6 +81,7 @@ def py2exe_options():
                         'mako',
                         'markupsafe',
                         'mock',
+                        'ofxparse',
                         'openerp',
                         'openid',
                         'passlib',
@@ -139,6 +140,7 @@ setup(
         'lxml',  # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
         'mako',
         'mock',
+        'ofxparse',
         'passlib',
         'pillow',  # windows binary http://www.lfd.uci.edu/~gohlke/pythonlibs/
         'psutil',  # windows binary code.google.com/p/psutil/downloads/list
diff --git a/setup/package.dfcentos b/setup/package.dfcentos
index e524fcbd3812..fd363f6210e4 100644
--- a/setup/package.dfcentos
+++ b/setup/package.dfcentos
@@ -40,7 +40,7 @@ RUN yum install -d 0 -e 0 epel-release -y && \
 		postgresql-devel -y && \
 	yum clean all
 
-RUN easy_install pyPdf vatnumber pydot psycogreen suds
+RUN easy_install pyPdf vatnumber pydot psycogreen suds ofxparse
 
 # Postgres configuration
 RUN mkdir -p /var/lib/postgres/data
diff --git a/setup/package.dfdebian b/setup/package.dfdebian
index 4dfdc728e122..7636e86f0d94 100644
--- a/setup/package.dfdebian
+++ b/setup/package.dfdebian
@@ -31,6 +31,7 @@ RUN apt-get update -qq &&  \
 		python-lxml \
 		python-mako \
 		python-mock \
+		python-ofxparse \
 		python-openid \
 		python-passlib \
 		python-psutil \
diff --git a/setup/redhat/postinstall.sh b/setup/redhat/postinstall.sh
index 76a94359d3a5..a0962cd62ff1 100644
--- a/setup/redhat/postinstall.sh
+++ b/setup/redhat/postinstall.sh
@@ -54,4 +54,4 @@ ExecStart=/usr/bin/odoo.py --config=/etc/odoo/openerp-server.conf
 [Install]
 WantedBy=multi-user.target
 EOF
-easy_install pyPdf vatnumber pydot psycogreen suds
+easy_install pyPdf vatnumber pydot psycogreen suds ofxparse
-- 
GitLab