hackDistribute.py (2436B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\hackDistribute.py 2 try: 3 import blue 4 blueContext = True 5 except ImportError: 6 blueContext = False 7 import shutil, os, platform, sys, stat 8 relativeBranchRoot = '../../' 9 version = {'2.7': 'python_27', 10 '2.6': 'python_26'}['.'.join(platform.python_version_tuple()[:2])] 11 is_64bits = sys.maxsize > 4294967296L 12 platformString = 'x64' if is_64bits else 'win32' 13 14 loadedDLLs = {} 15 16 def TimestampDoesNotMatch(f1, f2): 17 a = os.stat(f1).st_mtime 18 b = os.stat(f2).st_mtime 19 return abs(a - b) > 0.1 20 21 22 def GetModuleJit(app, module): 23 if not blueContext: 24 moduleFolder = '%(app)s/autobuild/%(module)s/%(pythonVersion)s/%(platform)s/' % {'app': app, 25 'module': module, 26 'pythonVersion': version, 27 'platform': platformString} 28 localPython = sys.executable 29 buildFolderLocation = os.path.abspath(os.path.join(__file__, relativeBranchRoot, moduleFolder)) 30 if buildFolderLocation not in sys.path: 31 print 'Extending sys.path with "%s" to load %s' % (buildFolderLocation, module) 32 sys.path.append(buildFolderLocation) 33 localVersion = os.path.abspath(os.path.join(sys.executable, '../DLLs/%s.pyd' % module)) 34 if os.path.exists(localVersion): 35 print 'Removing local version from "%s"' % localVersion 36 os.remove(localVersion) 37 38 39 def GetDLLJit(app, module, dllsFor32Bit, dllsFor64bit): 40 if not blueContext: 41 moduleLocation = '%(app)s/bin/%(module)s/%(platform)s' % {'app': app, 42 'module': module, 43 'pythonVersion': version, 44 'platform': platformString} 45 localPython = sys.executable 46 dllsToCopy = dllsFor64bit if is_64bits else dllsFor32Bit 47 import ctypes 48 for dll in dllsToCopy: 49 if dll in loadedDLLs: 50 continue 51 autobuildVersion = os.path.abspath(os.path.join(__file__, relativeBranchRoot, moduleLocation, dll)) 52 print 'Loading DLL explicitly from %s' % autobuildVersion 53 loadedDLL = ctypes.WinDLL(autobuildVersion) 54 loadedDLLs[dll] = loadedDLL 55 localVersion = os.path.abspath(os.path.join(sys.executable, '../DLLs/%s' % dll)) 56 if os.path.exists(localVersion): 57 print 'Removing local version from "%s"' % localVersion 58 os.remove(localVersion)