git: ebd41c653fa0 - main - devel/py-zope.datetime: Fix build with setuptools 58.0.0+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Mar 2022 13:50:21 UTC
The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=ebd41c653fa0d480ef6ddeb2617637c1758447b7 commit ebd41c653fa0d480ef6ddeb2617637c1758447b7 Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org> AuthorDate: 2022-03-25 13:32:29 +0000 Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org> CommitDate: 2022-03-25 13:38:14 +0000 devel/py-zope.datetime: Fix build with setuptools 58.0.0+ With hat: python --- devel/py-zope.datetime/files/patch-2to3 | 167 ++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) diff --git a/devel/py-zope.datetime/files/patch-2to3 b/devel/py-zope.datetime/files/patch-2to3 new file mode 100644 index 000000000000..085d5e1234e9 --- /dev/null +++ b/devel/py-zope.datetime/files/patch-2to3 @@ -0,0 +1,167 @@ +--- src/zope/datetime/__init__.py.orig 2011-11-29 16:29:14 UTC ++++ src/zope/datetime/__init__.py +@@ -87,7 +87,7 @@ i=int(yr-1) + to_year =int(i*365+i/4-i/100+i/400-693960.0) + to_month=tm[yr%4==0 and (yr%100!=0 or yr%400==0)][mo] + EPOCH =(to_year+to_month+dy+(hr/24.0+mn/1440.0+sc/86400.0))*86400 +-jd1901 =2415385L ++jd1901 =2415385 + + + numericTimeZoneMatch=re.compile(r'[+-][0-9][0-9][0-9][0-9]').match #TS +@@ -282,7 +282,7 @@ class _cache: + + def __init__(self): + self._db = _data +- self._d, self._zidx= {}, self._zmap.keys() ++ self._d, self._zidx= {}, list(self._zmap.keys()) + + def __getitem__(self,k): + try: n=self._zmap[k.lower()] +@@ -337,28 +337,28 @@ def _calcDependentSecond(tz, t): + # Calculates the timezone-dependent second (integer part only) + # from the timezone-independent second. + fset = _tzoffset(tz, t) +- return fset + long(math.floor(t)) + long(EPOCH) - 86400L ++ return fset + int(math.floor(t)) + int(EPOCH) - 86400 + + def _calcDependentSecond2(yr,mo,dy,hr,mn,sc): + # Calculates the timezone-dependent second (integer part only) + # from the date given. + ss = int(hr) * 3600 + int(mn) * 60 + int(sc) +- x = long(_julianday(yr,mo,dy)-jd1901) * 86400 + ss ++ x = int(_julianday(yr,mo,dy)-jd1901) * 86400 + ss + return x + + def _calcIndependentSecondEtc(tz, x, ms): + # Derive the timezone-independent second from the timezone + # dependent second. + fsetAtEpoch = _tzoffset(tz, 0.0) +- nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms ++ nearTime = x - fsetAtEpoch - int(EPOCH) + 86400 + ms + # nearTime is now within an hour of being correct. + # Recalculate t according to DST. +- fset = long(_tzoffset(tz, nearTime)) ++ fset = int(_tzoffset(tz, nearTime)) + x_adjusted = x - fset + ms + d = x_adjusted / 86400.0 +- t = x_adjusted - long(EPOCH) + 86400L ++ t = x_adjusted - int(EPOCH) + 86400 + millis = (x + 86400 - fset) * 1000 + \ +- long(ms * 1000.0) - long(EPOCH * 1000.0) ++ int(ms * 1000.0) - int(EPOCH * 1000.0) + s = d - math.floor(d) + return s,d,t,millis + +@@ -382,34 +382,34 @@ def _calcYMDHMS(x, ms): + return yr,mo,dy,hr,mn,sc + + def _julianday(yr,mo,dy): +- y,m,d=long(yr),long(mo),long(dy) +- if m > 12L: +- y=y+m/12L +- m=m%12L +- elif m < 1L: ++ y,m,d=int(yr),int(mo),int(dy) ++ if m > 12: ++ y=y+m/12 ++ m=m%12 ++ elif m < 1: + m=-m +- y=y-m/12L-1L +- m=12L-m%12L +- if y > 0L: yr_correct=0L +- else: yr_correct=3L +- if m < 3L: y, m=y-1L,m+12L +- if y*10000L+m*100L+d > 15821014L: b=2L-y/100L+y/400L +- else: b=0L +- return (1461L*y-yr_correct)/4L+306001L*(m+1L)/10000L+d+1720994L+b ++ y=y-m/12-1 ++ m=12-m%12 ++ if y > 0: yr_correct=0 ++ else: yr_correct=3 ++ if m < 3: y, m=y-1,m+12 ++ if y*10000+m*100+d > 15821014: b=2-y/100+y/400 ++ else: b=0 ++ return (1461*y-yr_correct)/4+306001*(m+1)/10000+d+1720994+b + + def _calendarday(j): +- j=long(j) +- if(j < 2299160L): +- b=j+1525L ++ j=int(j) ++ if(j < 2299160): ++ b=j+1525 + else: +- a=(4L*j-7468861L)/146097L +- b=j+1526L+a-a/4L +- c=(20L*b-2442L)/7305L +- d=1461L*c/4L +- e=10000L*(b-d)/306001L +- dy=int(b-d-306001L*e/10000L) +- mo=(e < 14L) and int(e-1L) or int(e-13L) +- yr=(mo > 2) and (c-4716L) or (c-4715L) ++ a=(4*j-7468861)/146097 ++ b=j+1526+a-a/4 ++ c=(20*b-2442)/7305 ++ d=1461*c/4 ++ e=10000*(b-d)/306001 ++ dy=int(b-d-306001*e/10000) ++ mo=(e < 14) and int(e-1) or int(e-13) ++ yr=(mo > 2) and (c-4716) or (c-4715) + return int(yr),int(mo),int(dy) + + def _tzoffset(tz, t): +@@ -619,7 +619,7 @@ class DateTimeParser: + if not self._multipleZones: + return self._localzone0 + fsetAtEpoch = _tzoffset(self._localzone0, 0.0) +- nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms ++ nearTime = x - fsetAtEpoch - int(EPOCH) + 86400 + ms + # nearTime is within an hour of being correct. + try: + ltm = safelocaltime(nearTime) +@@ -631,7 +631,7 @@ class DateTimeParser: + yr,mo,dy,hr,mn,sc = _calcYMDHMS(x, 0) + yr = ((yr - 1970) % 28) + 1970 + x = _calcDependentSecond2(yr,mo,dy,hr,mn,sc) +- nearTime = x - fsetAtEpoch - long(EPOCH) + 86400L + ms ++ nearTime = x - fsetAtEpoch - int(EPOCH) + 86400 + ms + ltm = safelocaltime(nearTime) + tz = self.localZone(ltm) + return tz +--- src/zope/datetime/timezones.py.orig 2011-11-29 16:29:14 UTC ++++ src/zope/datetime/timezones.py +@@ -1178,23 +1178,23 @@ historical_zone_info = { + + def dumpTimezoneInfo(_data): + +- print "historical_zone_info = {" ++ print("historical_zone_info = {") + +- items = _data.items() ++ items = list(_data.items()) + items.sort() + for key, value in items: + v1, v2, v3, ilist, bitmap, two_by_three, two_nullterm = value +- print "'%s': ('%s', %s, %s," % (key, v1, v2, v3) +- print "[", ++ print("'%s': ('%s', %s, %s," % (key, v1, v2, v3)) ++ print("[", end=' ') + while ilist: + next_5, ilist = ilist[:5], ilist[5:] + line = ", ".join(["'%s'" % x for x in next_5]) +- print "%s," % line +- print "], " +- print "%s," % repr(bitmap) +- print "%s, %s)," % (repr(two_by_three), repr(two_nullterm)) ++ print("%s," % line) ++ print("], ") ++ print("%s," % repr(bitmap)) ++ print("%s, %s)," % (repr(two_by_three), repr(two_nullterm))) + +- print "}" ++ print("}") + + if __name__ == '__main__': + dumpTimezoneInfo(historical_zone_info)