Don't use importlib for version

This commit is contained in:
Balázs Dukai
2023-06-14 02:26:28 +02:00
parent 435090e7f1
commit 2b71b33c82
2 changed files with 3 additions and 4 deletions
@@ -1,4 +1,3 @@
# ifccityjson - Python CityJSON to IFC converter # ifccityjson - Python CityJSON to IFC converter
# Copyright (C) 2021 Laurens J.N. Oostwegel <l.oostwegel@gmail.com> # Copyright (C) 2021 Laurens J.N. Oostwegel <l.oostwegel@gmail.com>
# #
@@ -16,5 +15,5 @@
# #
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with ifccityjson. If not, see <http://www.gnu.org/licenses/>. # along with ifccityjson. If not, see <http://www.gnu.org/licenses/>.
__version__ = "0.1.0"
from .cityjson2ifc import * from .cityjson2ifc import *
@@ -18,12 +18,12 @@
# along with ifccityjson. If not, see <http://www.gnu.org/licenses/>. # along with ifccityjson. If not, see <http://www.gnu.org/licenses/>.
import os import os
from importlib.metadata import version as pkg_version
import ifcopenshell import ifcopenshell
import ifcopenshell.api import ifcopenshell.api
from datetime import datetime from datetime import datetime
from .geometry import GeometryIO from .geometry import GeometryIO
from . import __version__
JSON_TO_IFC = { JSON_TO_IFC = {
"Building": ["IfcBuilding"], "Building": ["IfcBuilding"],
@@ -197,7 +197,7 @@ class Cityjson2ifc:
"IfcOpenShell, an open source (LGPL) software library that helps users and software developers to work with the IFC file format.", "IfcOpenShell, an open source (LGPL) software library that helps users and software developers to work with the IFC file format.",
) )
p_o = self.IFC_model.createIfcPersonAndOrganization(person, organization) p_o = self.IFC_model.createIfcPersonAndOrganization(person, organization)
application = self.IFC_model.createIfcApplication(organization, pkg_version("ifccityjson"), "ifccityjson", "ifccityjson") application = self.IFC_model.createIfcApplication(organization, __version__, "ifccityjson", "ifccityjson")
timestamp = int(datetime.now().timestamp()) timestamp = int(datetime.now().timestamp())
ownerHistory = self.IFC_model.createIfcOwnerHistory(p_o, application, "READWRITE", None, None, None, None, ownerHistory = self.IFC_model.createIfcOwnerHistory(p_o, application, "READWRITE", None, None, None, None,
timestamp) timestamp)