Skip to content

Commit

Permalink
disable future division
Browse files Browse the repository at this point in the history
...caused `TypeError: slice indices must be integers or None or have an
__index__ method` in `apt available` and probably similar things
elsewhere. Disabling didn't break the update-only-if-newer logic in
dodo_download().
  • Loading branch information
maphew committed Mar 31, 2015
1 parent 3a105eb commit 154f90c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
#@+leo-ver=5-thin
#@+node:maphew.20150327024628.2: * @file apt.py
#@@first
# Added for urltime_to_datetime, datetime_to_unixtime
from __future__ import division
from datetime import datetime, timedelta
#@@language python
#@@tabwidth -4
#@+<<docstring>>
#@+node:maphew.20100307230644.3846: ** <<docstring>>
'''
Expand All @@ -14,10 +13,8 @@
License: GNU GPL
Modified by [email protected] for OSGeo4W,
beginning July 2008
'''
apt_version = '0.3-1-dev'
#@-<<docstring>>
Expand All @@ -38,11 +35,10 @@
import subprocess
import shlex
import locale
from datetime import datetime, timedelta
#from attrdict import AttrDict

#@-<<imports>>
#@@language python
#@@tabwidth -4
#@+others
#@+node:maphew.20100223163802.3718: ** usage
def usage ():
Expand Down Expand Up @@ -889,6 +885,11 @@ def datetime_to_unixtime(dt, epoch=datetime(1970,1,1)):
''' Convert a datetime object to unix UTC time (seconds since beginning).
Adapted from http://stackoverflow.com/questions/8777753/converting-datetime-date-to-utc-timestamp-in-python/
It wants `from __future__ import division`, but that caused issues in other
functions, automatically coverting what used to produce integers into floats
(e.g. "50/2"). It seems to be safe to not use it, but leaving this note just
in case...
'''
td = dt - epoch
# return td.total_seconds()
Expand Down Expand Up @@ -948,6 +949,7 @@ def dodo_download(url, dstFile):

if url_time <= file_time:
print "Skipping download - url modified time isn't newer than local file"
print dstFile
return dstFile

if not os.path.exists(os.path.dirname(dstFile)):
Expand Down

0 comments on commit 154f90c

Please sign in to comment.