changeset 1935:1128feb54180

core: removed pyfeed and xe dependencies: pyfeed and xe where still used only for date format handling, and there is already dateutil which is a dependency of Wokkel. Furthermore pyfeed and xe are still not on pypi, causing troubles for installation with pip
author Goffi <goffi@goffi.org>
date Sun, 17 Apr 2016 17:08:12 +0200
parents 2daf7b4c6756
children 6881fc145d59
files INSTALL README frontends/src/tools/strings.py setup.py src/__init__.py src/plugins/plugin_xep_0277.py src/tools/utils.py
diffstat 7 files changed, 11 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/INSTALL	Sun Apr 17 14:45:26 2016 +0200
+++ b/INSTALL	Sun Apr 17 17:08:12 2016 +0200
@@ -5,17 +5,13 @@
 
 You can automatically install SàT and its dependencies using easy_install or pip. You will however need to install Python's headers (needed to build some packages), WxPython which is available in most Gnu/Linux distributions, PyGObject and developments version of libxml2 and libxslt (to compile lxml python library).
 
-NOTE: pyfeed and xe are mandatory dependencies, they should be on http://pypi.python.org (PYthon Package Index, the official repository for Python projects) and so being automatically installed; but they are not yet there (their author should do it soon), so you have to install them manually until then.
-You can download them respectively on http://home.avvanta.com/%7Esteveha/pyfeed-0.7.4.tar.gz and http://home.avvanta.com/%7Esteveha/xe-0.7.4.tar.gz, then decompress them and do « python setup.py install » on both.
-An other way is to use the (insecure) pip options --process-dependency-links and --allow-all-external when installing sat, options which will soon be (or already are) removed from pip.
-
 
 The environment variable SAT_INSTALL customises the installation, it contains flags separated by spaces:
 	- "nopreinstall" skips all preinstallation checks
 	- "autodeb" automatically installs missing packages on Debian-based distributions
 	- "nox" disables installation of X-based packages (WxWidgets), this is useful for servers
 
-WxPython and PyGobject are automatically installed on Debian-based distributions if "autodeb" option is set. Indeed, on Debian-based distribution, you can type (with the root account):
+PyGobject is automatically installed on Debian-based distributions if "autodeb" option is set. Indeed, on Debian-based distribution, you can type (with the root account):
 
 # apt-get install python-pip python-dev libxml2-dev libxslt-dev
 # SAT_INSTALL=autodeb pip install .
--- a/README	Sun Apr 17 14:45:26 2016 +0200
+++ b/README	Sun Apr 17 17:08:12 2016 +0200
@@ -105,9 +105,6 @@
 Pyjamas:
 Libervia is built with a Pyjamas (http://pyjs.org), a Google Web Toolkit port for python, including Python to Javascript compiler, and Pyjamas Desktop which allow to execute the same application on the desktop or through a browser. It's really an amazing tool.
 
-Pyfeed and Xe:
-SàT core and Libervia use pyfeed and xe (http://home.avvanta.com/%7Esteveha/pyfeed.html), 2 libraries made Steve R. Hastings really useful to parse/generate xml stuff as atom feeds.
-
 lxml(http://lxml.de/):
 this powerful and efficient XML parsing module is used sometimes to replace Twisted internal tools: its API is handy, and it have some features like evil content cleaning.
 
--- a/frontends/src/tools/strings.py	Sun Apr 17 14:45:26 2016 +0200
+++ b/frontends/src/tools/strings.py	Sun Apr 17 17:08:12 2016 +0200
@@ -18,7 +18,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import re
-from feed.atom import Content
 
 
 def getURLParams(url):
--- a/setup.py	Sun Apr 17 14:45:26 2016 +0200
+++ b/setup.py	Sun Apr 17 17:08:12 2016 +0200
@@ -303,7 +303,6 @@
                   ],
       scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus', ],
       zip_safe=False,
-      dependency_links=['http://home.avvanta.com/%7Esteveha/pyfeed-0.7.4.tar.gz', 'http://home.avvanta.com/%7Esteveha/xe-0.7.4.tar.gz'],
-      install_requires=['twisted >= 15.2.0', 'wokkel >= 0.7.1', 'progressbar', 'urwid >= 1.2.0', 'urwid-satext >= 0.4.0', 'pyfeed', 'xe', 'mutagen', 'pillow', 'lxml >= 3.1.0', 'pyxdg', 'markdown', 'html2text', 'pycrypto >= 2.6.1', 'python-potr', 'PyOpenSSL'],
+      install_requires=['twisted >= 15.2.0', 'wokkel >= 0.7.1', 'progressbar', 'urwid >= 1.2.0', 'urwid-satext >= 0.4.0', 'mutagen', 'pillow', 'lxml >= 3.1.0', 'pyxdg', 'markdown', 'html2text', 'pycrypto >= 2.6.1', 'python-potr', 'PyOpenSSL'],
       cmdclass={'install': CustomInstall},
       )
--- a/src/__init__.py	Sun Apr 17 14:45:26 2016 +0200
+++ b/src/__init__.py	Sun Apr 17 17:08:12 2016 +0200
@@ -1,3 +1,3 @@
-from core.constants import Const as C
+from .core.constants import Const as C
 
 __version__ = C.APP_VERSION
--- a/src/plugins/plugin_xep_0277.py	Sun Apr 17 14:45:26 2016 +0200
+++ b/src/plugins/plugin_xep_0277.py	Sun Apr 17 17:08:12 2016 +0200
@@ -28,16 +28,15 @@
 from sat.core import exceptions
 from sat.tools import xml_tools
 from sat.tools import sat_defer
+from sat.tools import utils
 from sat.tools.common import data_format
 
 # XXX: tmp.pubsub is actually use instead of wokkel version
 from wokkel import pubsub
-try:
-    from feed.date import rfc3339
-except ImportError:
-    raise exceptions.MissingModule(u"Missing module pyfeed, please download/install it from http://home.avvanta.com/~steveha/pyfeed.html")
 import uuid
 import time
+import dateutil
+import calendar
 import urlparse
 
 NS_MICROBLOG = 'urn:xmpp:microblog:0'
@@ -252,13 +251,13 @@
         except StopIteration:
             msg = u'No atom updated element found in the pubsub item {}'.format(id_)
             raise failure.Failure(exceptions.DataError(msg))
-        microblog_data[u'updated'] = unicode(rfc3339.tf_from_timestamp(unicode(updated_elt)))
+        microblog_data[u'updated'] = unicode(calendar.timegm(dateutil.parser.parse(unicode(updated_elt)).utctimetuple()))
         try:
             published_elt = entry_elt.elements(NS_ATOM, 'published').next()
         except StopIteration:
             microblog_data[u'published'] = microblog_data[u'updated']
         else:
-            microblog_data[u'published'] = unicode(rfc3339.tf_from_timestamp(unicode(published_elt)))
+            microblog_data[u'published'] = unicode(calendar.timegm(dateutil.parser.parse(unicode(published_elt)).utctimetuple()))
 
         # links
         for link_elt in entry_elt.elements(NS_ATOM, 'link'):
@@ -421,9 +420,9 @@
         ## published/updated time ##
         current_time = time.time()
         entry_elt.addElement('updated',
-            content=rfc3339.timestamp_from_tf(float(data.get('updated', current_time))))
+            content = utils.xmpp_date(float(data.get('updated', current_time))))
         entry_elt.addElement('published',
-            content=rfc3339.timestamp_from_tf(float(data.get('published', current_time))))
+            content = utils.xmpp_date(float(data.get('published', current_time))))
 
         ## categories ##
         for tag in data_format.dict2iter("tag", data):
--- a/src/tools/utils.py	Sun Apr 17 14:45:26 2016 +0200
+++ b/src/tools/utils.py	Sun Apr 17 17:08:12 2016 +0200
@@ -43,6 +43,7 @@
     """Return date according to XEP-0082 specification
 
     to avoid reveling the timezone, we always return UTC dates
+    the string returned by this method is valid with RFC 3339
     @param timestamp(None, float): posix timestamp. If None current time will be used
     @param with_time(bool): if True include the time
     @return(unicode): XEP-0082 formatted date and time