-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
davidvlaminck
committed
Jun 11, 2024
1 parent
1fd48fa
commit 8ab2621
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import logging | ||
import urllib.request | ||
from pathlib import Path | ||
from subprocess import Popen, PIPE | ||
|
||
from otlmow_modelbuilder.ModelBuilder import ModelBuilder | ||
from otlmow_modelbuilder.OSLOInMemoryCreator import OSLOInMemoryCreator | ||
|
||
from model_update.ModelUpdater import ModelUpdater | ||
|
||
logging.basicConfig(level=logging.INFO, format='%(message)s') | ||
|
||
urllib.request.urlretrieve("https://github.com/davidvlaminck/OTLMOW-ModelBuilder/raw/master/otlmow_modelbuilder" | ||
"/InputFiles/latest/OTL.db", 'OTL.db') | ||
urllib.request.urlretrieve("https://github.com/davidvlaminck/OTLMOW-ModelBuilder/raw/master/otlmow_modelbuilder" | ||
"/InputFiles/latest/Geometrie_Artefact.db", 'Geometrie_Artefact.db') | ||
urllib.request.urlretrieve("https://github.com/davidvlaminck/OTLMOW-ModelBuilder/raw/master/otlmow_modelbuilder" | ||
"/settings_otlmow_modelbuilder.json", 'settings_otlmow_modelbuilder.json') | ||
|
||
current_dir = Path(__file__).parent | ||
otl_subset_path = Path(current_dir / 'OTL.db') | ||
GA_file_path = Path(current_dir / 'Geometrie_Artefact.db') | ||
model_directory = Path(current_dir.parent / 'otlmow_model') | ||
settings_path = Path(current_dir / 'settings_otlmow_modelbuilder.json') | ||
|
||
with OSLOInMemoryCreator(otl_subset_path) as memory_creator: | ||
version = memory_creator.get_otl_version() | ||
|
||
ModelBuilder.build_otl_datamodel(otl_subset_location=otl_subset_path, geometry_artefact_location=GA_file_path, | ||
directory=model_directory, settings_path=settings_path, | ||
environment='prd') | ||
|
||
cmd = "git add ./../otlmow_model/OtlmowModel" | ||
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) | ||
stdout, stderr = p.communicate() | ||
|
||
updater = ModelUpdater(github_root=current_dir.parent) | ||
enums_updated = updater.find_changed_enums() | ||
updater.update_model(otl_version=version, created_by='david.vlaminck', enums_updated=enums_updated) |