Skip to content

Commit

Permalink
Release 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbouteiller committed Mar 7, 2023
1 parent 8ab2852 commit 424c652
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,25 @@ def url_retrieve(url: str, outfile: Path, overwrite: bool = False):
if OPENPLANET_FOLDER.exists():
# copy the OpenPlanet script:
try:
OP_SCRIPTS_FOLDER = OPENPLANET_FOLDER / "Scripts"
OP_SCRIPTS_FOLDER.mkdir(parents=True, exist_ok=True)
TM20_SCRIPT_FILE = RESOURCES_FOLDER / 'Scripts' / 'Plugin_GrabData_0_2.as'
TM20_SCRIPT_FILE_SIG = RESOURCES_FOLDER / 'Scripts' / 'Plugin_GrabData_0_2.as.sig'
copy2(TM20_SCRIPT_FILE, OP_SCRIPTS_FOLDER)
copy2(TM20_SCRIPT_FILE_SIG, OP_SCRIPTS_FOLDER)
# remove old script if found
OP_SCRIPTS_FOLDER = OPENPLANET_FOLDER / 'Scripts'
if OP_SCRIPTS_FOLDER.exists():
to_remove = [OP_SCRIPTS_FOLDER / 'Plugin_GrabData_0_1.as',
OP_SCRIPTS_FOLDER / 'Plugin_GrabData_0_1.as.sig',
OP_SCRIPTS_FOLDER / 'Plugin_GrabData_0_2.as',
OP_SCRIPTS_FOLDER / 'Plugin_GrabData_0_2.as.sig']
for old_file in to_remove:
if old_file.exists():
old_file.unlink()
# copy new plugin
OP_PLUGINS_FOLDER = OPENPLANET_FOLDER / 'Plugins'
OP_PLUGINS_FOLDER.mkdir(parents=True, exist_ok=True)
TM20_PLUGIN = RESOURCES_FOLDER / 'Plugins' / 'TMRL_GrabData.op'
copy2(TM20_PLUGIN, OP_PLUGINS_FOLDER)
except Exception as e:
print(
f"An exception was caught when trying to copy the OpenPlanet script and signature automatically. \
Please copy these files manually for TrackMania 2020 support. The caught exception was: {str(e)}.")
f"An exception was caught when trying to copy the OpenPlanet plugin automatically. \
Please copy the plugin manually for TrackMania 2020 support. The caught exception was: {str(e)}.")
else:
# warn the user that OpenPlanet couldn't be found:
print(f"The OpenPlanet folder was not found at {OPENPLANET_FOLDER}. \
Expand Down

0 comments on commit 424c652

Please sign in to comment.