def _upgrade(): global _upgraded global _sqlite3 try: import sys import platform if "windows" in platform.system().lower(): original_dll = File.new_instance(sys.exec_prefix, "dlls/sqlite3.dll") if platform.architecture()[0] == "32bit": source_dll = File( "vendor/pyLibrary/vendor/sqlite/sqlite3_32.dll") else: source_dll = File( "vendor/pyLibrary/vendor/sqlite/sqlite3_64.dll") if not all(a == b for a, b in zip_longest( source_dll.read_bytes(), original_dll.read_bytes())): original_dll.backup() File.copy(source_dll, original_dll) else: pass except Exception as e: Log.warning("could not upgrade python's sqlite", cause=e) import sqlite3 as _sqlite3 _ = _sqlite3 _upgraded = True
def test_read_home(self): file = "~/___test_file.json" source = File.new_instance( get_stacktrace(0)[0]["file"], "../resources/simple.json") File.copy(File(source), File(file)) content = mo_json_config.get("file:///" + file) try: self.assertEqual(content, {"test_key": "test_value"}) finally: File(file).delete()
def _upgrade(): global _upgraded _upgraded = True try: import sys sqlite_dll = File.new_instance(sys.exec_prefix, "dlls/sqlite3.dll") python_dll = File("pyLibrary/vendor/sqlite/sqlite3.dll") if python_dll.read_bytes() != sqlite_dll.read_bytes(): backup = sqlite_dll.backup() File.copy(python_dll, sqlite_dll) except Exception as e: Log.warning("could not upgrade python's sqlite", cause=e)
def _upgrade(): global _upgraded _upgraded = True try: import sys sqlite_dll = File.new_instance(sys.exec_prefix, "dlls/sqlite3.dll") python_dll = File("pyLibrary/vendor/sqlite/sqlite3.dll") if python_dll.read_bytes() != sqlite_dll.read_bytes(): backup = sqlite_dll.backup() File.copy(python_dll, sqlite_dll) except Exception as e: Log.warning("could not upgrade python's sqlite", cause=e)
def _upgrade(): global _upgraded global sqlite3 try: import sys Log.error("Fix to work with 64bit windows too") original_dll = File.new_instance(sys.exec_prefix, "dlls/sqlite3.dll") source_dll = File("vendor/pyLibrary/vendor/sqlite/sqlite3.dll") if not all(a == b for a, b in zip_longest(source_dll.read_bytes(), original_dll.read_bytes())): backup = original_dll.backup() File.copy(source_dll, original_dll) except Exception as e: Log.warning("could not upgrade python's sqlite", cause=e) import sqlite3 _ = sqlite3 _upgraded = True