Skip to content

Commit

Permalink
use importlib.metadata.version
Browse files Browse the repository at this point in the history
  • Loading branch information
yannrichet committed Nov 28, 2024
1 parent ceb2022 commit 6b90549
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Funz/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def setupCalculator():
else:
subprocess.call(["xdg-open", '"'+os.path.join(FUNZ_HOME,"calculator.xml")+'"'])

import tempfile#, pkg_resources
import tempfile, importlib, importlib.metadata
def install_githubModel(model,force=False, edit_script=False):
""" Install Funz model plugin from central GitHub repository.
@param model model to install.
Expand All @@ -184,7 +184,7 @@ def install_githubModel(model,force=False, edit_script=False):
install_githubModel('Modelica')
}
"""
major = re.sub(".post(.*)","",Funz.__version__) #pkg_resources.get_distribution("Funz").version)
major = re.sub(".post(.*)","",importlib.metadata.version('Funz'))
model_zip = os.path.join(tempfile.gettempdir(),"plugin-"+model+".zip")
for minor in range(11)[::-1]:
print(".", end = '')
Expand Down Expand Up @@ -285,7 +285,7 @@ def install_fileDesign(design_zip, force=False):
else:
print("Installed Funz design "+design)

import tempfile#, pkg_resources
import tempfile, importlib, importlib.metadata
def install_githubDesign(design,force=False):
""" Install Funz design plugin from central GitHub repository.
@param design design to install.
Expand All @@ -296,8 +296,7 @@ def install_githubDesign(design,force=False):
install_githubDesign('GradientDescent')
}
"""
major = re.sub(".post(.*)","",Funz.__version__)
#pkg_resources.get_distribution("Funz").version)
major = re.sub(".post(.*)","",importlib.metadata.version('Funz'))
design_zip = os.path.join(tempfile.gettempdir(),"algorithm-"+design+".zip")
for minor in range(11)[::-1]:
print(".", end = '')
Expand Down

0 comments on commit 6b90549

Please sign in to comment.