text: import argparse, os, sys
  from pathlib import Path
  import json
  import urllib.request
  
  from inc.shared.inc.helpers.config_helpers import load_yaml_config
  from inc.shared.inc.helpers.gtfs_helpers import compute_formatted_date_from_gtfs_folder_path
  
  def main():
      print('SETUP server')
  
      script_path = Path(os.path.realpath(__file__))
  
      app_config_path = Path(f'{script_path.parent}/inc/config.yml')
      if not os.path.isfile(app_config_path):
          print(f'ERROR: cant load config from {app_config_path}')
          sys.exit(1)
      app_config = load_yaml_config(app_config_path, script_path.parent)
  
      for key in app_config['tmp-data-paths']:
          dir_path = app_config['tmp-data-paths'][key]
          if os.path.isdir(dir_path):
              print(f'... folder {dir_path} exists, skipping ...')
              continue
          
          print(f'... creating {dir_path}')
          os.makedirs(dir_path, exist_ok=True)
      
      env_file_version = app_config['env_file_version']
  
      env_file_lines = [
          '# Generated by setup.py',
          '',
          f'APP_VERSION={env_file_version}',
      ]
      for env_key in app_config['env_data_keys']:
          env_value = app_config['env_data_keys'][env_key]
          env_file_line = f'{env_key}={env_value}'
          env_file_lines.append(env_file_line)
      env_file_lines_s = "\n".join(env_file_lines)
  
      env_file_path = app_config['env_file_path']
      env_file = open(env_file_path, 'w')
      env_file.write(env_file_lines_s)
      env_file.close()
  
      print(f'Wrote to {env_file_path}')
  
  if __name__ == "__main__":
      main()