-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
44 lines (37 loc) · 1.71 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""Module to create necessary folders and move files to the correct directories. Run this module first before you run
anything else.
"""
from os import environ, mkdir
from os.path import exists, join
from beamngpy.beamngcommon import ENV
from shutil import move, copyfile
from distutils.dir_util import copy_tree
def init_scenario_folder():
"""Creates the urban and scenarios directory in the BeamNG trunk directory, if is doesn't exists.
:return: Void.
"""
assert environ.get("BNG_HOME") is not None, "Please set the BNG_HOME environment variable."
urban_folder = join(ENV['BNG_HOME'], "levels", "urban")
if not exists(urban_folder):
mkdir(urban_folder)
scenario_folder = join(ENV['BNG_HOME'], "levels", "urban", "scenarios")
if not exists(scenario_folder):
mkdir(scenario_folder)
def move_files_to_bng_folder():
"""Moves files from this directory to the bng trunk directory.
:return: Void.
"""
assert environ.get("BNG_HOME") is not None, "Please set the BNG_HOME environment variable."
vehicle_folder = join(ENV['BNG_HOME'], "vehicles", "87Golf")
copy_tree("87Golf", vehicle_folder)
levels_folder = join(ENV['BNG_HOME'], "levels", "urban")
copy_tree("urban", levels_folder)
lua_folder = join(ENV['BNG_HOME'], "lua", "ge", "extensions", "scenario", "scenariohelper.lua")
copyfile("scenariohelper.lua", lua_folder)
weather_folder = join(ENV['BNG_HOME'], "art", "weather", "defaults.json")
copyfile("defaults.json", weather_folder)
rve_folder = join(ENV['BNG_HOME'], "lua", "vehicle", "extensions", "researchVE.lua")
copyfile("researchVE.lua", rve_folder)
if __name__ == '__main__':
move_files_to_bng_folder()
init_scenario_folder()