Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)

To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
This commit is contained in:
Konstantin Pastbin
2025-04-13 16:37:30 +07:00
commit e3e4a1985a
12931 changed files with 13195100 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
import logging
import os
import tarfile
from six import BytesIO
from data_files import find_data_files
try:
import lzma
except ImportError:
from backports import lzma
logger = logging.getLogger(__name__)
def init(borders_path=None):
data_path = find_data_files("omim-data")
if data_path is None:
logger.error("omim-data was not found.")
return False
if borders_path is None:
borders_path = os.path.join(data_path, "borders")
if not os.path.exists(borders_path):
tar_lzma_path = os.path.join(data_path, "borders.tar.xz")
lzma_stream = BytesIO()
with open(tar_lzma_path, mode="rb") as f:
decompressed = lzma.decompress(f.read())
lzma_stream.write(decompressed)
lzma_stream.seek(0)
try:
with tarfile.open(fileobj=lzma_stream, mode="r") as tar:
tar.extractall(borders_path)
except PermissionError as e:
logger.error(str(e))
return False
logger.info("{} was created.".format(borders_path))
return True