1# -*- coding: utf-8 -*- 2""" 3 jinja2._ipysupport 4 ~~~~~~~~~~~~~~~~~~ 5 6 IronPython support library. This library exports functionality from 7 the CLR to Python that is normally available in the standard library. 8 9 :copyright: (c) 2009 by the Jinja Team. 10 :license: BSD. 11""" 12from System import DateTime 13from System.IO import Path, File, FileInfo 14 15 16epoch = DateTime(1970, 1, 1) 17 18 19class _PathModule(object): 20 """A minimal path module.""" 21 22 sep = str(Path.DirectorySeparatorChar) 23 altsep = str(Path.AltDirectorySeparatorChar) 24 pardir = '..' 25 26 def join(self, path, *args): 27 args = list(args[::-1]) 28 while args: 29 path = Path.Combine(path, args.pop()) 30 return path 31 32 def isfile(self, filename): 33 return File.Exists(filename) 34 35 def getmtime(self, filename): 36 info = FileInfo(filename) 37 return int((info.LastAccessTimeUtc - epoch).TotalSeconds) 38 39 40path = _PathModule() 41