diff --git a/configurator/__init__.py b/configurator/__init__.py new file mode 100644 index 0000000..7aff21c --- /dev/null +++ b/configurator/__init__.py @@ -0,0 +1 @@ +from .configurator import * \ No newline at end of file diff --git a/sumo-configurator/configurator.py b/configurator/configurator.py similarity index 68% rename from sumo-configurator/configurator.py rename to configurator/configurator.py index 6493945..be54271 100644 --- a/sumo-configurator/configurator.py +++ b/configurator/configurator.py @@ -5,9 +5,12 @@ import subprocess import randomTrips +# Absolute path of the directory the script is in +SCRIPTDIR = os.path.dirname(__file__) +STATICDIR = os.path.join(SCRIPTDIR, 'static') SIMNAME = 'simul' -NETCONVERTCMD = ['netconvert', '-c', f'static/{SIMNAME}.netcfg'] -POLYCONVERTCMD = ['polyconvert', '-c', f'static/{SIMNAME}.polycfg'] +NETCONVERTCMD = ['netconvert', '-c', os.path.join(STATICDIR, f'{SIMNAME}.netcfg')] +POLYCONVERTCMD = ['polyconvert', '-c', os.path.join(STATICDIR, f'{SIMNAME}.polycfg')] def clean(): @@ -22,15 +25,15 @@ def generate_scenario(out_path, name): print('Extracting polygons…') subprocess.run(POLYCONVERTCMD) print('Moving files') - shutil.move('static/simul.net.xml', os.path.join(out_path, f'{name}.net.xml')) - shutil.move('static/simul.poly.xml', os.path.join(out_path, f'{name}.poly.xml')) - shutil.copyfile('static/simul.sumocfg', os.path.join(out_path, f'{name}.sumocfg')) + shutil.move(os.path.join(STATICDIR, 'simul.net.xml'), os.path.join(out_path, f'{name}.net.xml')) + shutil.move(os.path.join(STATICDIR, 'simul.poly.xml'), os.path.join(out_path, f'{name}.poly.xml')) + shutil.copyfile(os.path.join(STATICDIR, 'simul.sumocfg'), os.path.join(out_path, f'{name}.sumocfg')) # Move log files logdir = os.path.join(out_path, 'log') os.mkdir(logdir) - for f in os.listdir('static'): + for f in os.listdir(STATICDIR): if f.endswith('.log'): - shutil.move(os.path.join('static', f), os.path.join(logdir, f)) + shutil.move(os.path.join(STATICDIR, f), os.path.join(logdir, f)) def generate_mobility(path, name): diff --git a/sumo-configurator/static/simul.netcfg b/configurator/static/simul.netcfg similarity index 100% rename from sumo-configurator/static/simul.netcfg rename to configurator/static/simul.netcfg diff --git a/sumo-configurator/static/simul.polycfg b/configurator/static/simul.polycfg similarity index 100% rename from sumo-configurator/static/simul.polycfg rename to configurator/static/simul.polycfg diff --git a/sumo-configurator/static/simul.raw.osm b/configurator/static/simul.raw.osm similarity index 100% rename from sumo-configurator/static/simul.raw.osm rename to configurator/static/simul.raw.osm diff --git a/sumo-configurator/static/simul.sumocfg b/configurator/static/simul.sumocfg similarity index 100% rename from sumo-configurator/static/simul.sumocfg rename to configurator/static/simul.sumocfg diff --git a/sumo-configurator/static/typemap/osmBidiRailNetconvert.typ.xml b/configurator/static/typemap/osmBidiRailNetconvert.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmBidiRailNetconvert.typ.xml rename to configurator/static/typemap/osmBidiRailNetconvert.typ.xml diff --git a/sumo-configurator/static/typemap/osmNetconvert.typ.xml b/configurator/static/typemap/osmNetconvert.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmNetconvert.typ.xml rename to configurator/static/typemap/osmNetconvert.typ.xml diff --git a/sumo-configurator/static/typemap/osmNetconvertBicycle.typ.xml b/configurator/static/typemap/osmNetconvertBicycle.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmNetconvertBicycle.typ.xml rename to configurator/static/typemap/osmNetconvertBicycle.typ.xml diff --git a/sumo-configurator/static/typemap/osmNetconvertPedestrians.typ.xml b/configurator/static/typemap/osmNetconvertPedestrians.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmNetconvertPedestrians.typ.xml rename to configurator/static/typemap/osmNetconvertPedestrians.typ.xml diff --git a/sumo-configurator/static/typemap/osmNetconvertShips.typ.xml b/configurator/static/typemap/osmNetconvertShips.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmNetconvertShips.typ.xml rename to configurator/static/typemap/osmNetconvertShips.typ.xml diff --git a/sumo-configurator/static/typemap/osmNetconvertUrbanDe.typ.xml b/configurator/static/typemap/osmNetconvertUrbanDe.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmNetconvertUrbanDe.typ.xml rename to configurator/static/typemap/osmNetconvertUrbanDe.typ.xml diff --git a/sumo-configurator/static/typemap/osmPolyconvert.boundaries.typ.xml b/configurator/static/typemap/osmPolyconvert.boundaries.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmPolyconvert.boundaries.typ.xml rename to configurator/static/typemap/osmPolyconvert.boundaries.typ.xml diff --git a/sumo-configurator/static/typemap/osmPolyconvert.typ.xml b/configurator/static/typemap/osmPolyconvert.typ.xml similarity index 100% rename from sumo-configurator/static/typemap/osmPolyconvert.typ.xml rename to configurator/static/typemap/osmPolyconvert.typ.xml diff --git a/sumo-configurator/__init__.py b/sumo-configurator/__init__.py deleted file mode 100644 index e69de29..0000000