# Path: alibuild_helpers/utilities.py
# def format(s, **kwds):
#   if sys.version_info[0] >= 3:
#     if isinstance(s, bytes):
#       try:
#         s = s.decode("utf-8")  # to get newlines as such and not as escaped \n
#       except:
#         s = s.decode("latin-1")  # Workaround issue with some special characters of latin-1 which are not understood by unicode
#     else:
#       s = str(s)
#   elif isinstance(s, str):
#     s = unicode(s, "utf-8")  # utf-8 is a safe assumption
#   elif not isinstance(s, unicode):
#     s = unicode(str(s))
#   return s % kwds
# 
# def detectArch():
#   try:
#     with open("/etc/os-release") as osr:
#       osReleaseLines = osr.readlines()
#     hasOsRelease = True
#   except (IOError,OSError):
#     osReleaseLines = []
#     hasOsRelease = False
#   try:
#     import platform
#     if platform.system() == "Darwin":
#       if platform.machine() == "x86_64":
#         return "osx_x86-64"
#       else:
#         return "osx_arm64"
#   except:
#     pass
#   try:
#     import platform, distro
#     platformTuple = distro.linux_distribution()
#     platformSystem = platform.system()
#     platformProcessor = platform.processor()
#     if not platformProcessor or " " in platformProcessor:
#       platformProcessor = platform.machine()
#     return doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, platformProcessor)
#   except:
#     return doDetectArch(hasOsRelease, osReleaseLines, ["unknown", "", ""], "", "")
# 
# Path: alibuild_helpers/utilities.py
# def normalise_multiple_options(option, sep=","):
#   return [x for x in ",".join(option).split(sep) if x]


import argparse
import multiprocessing
import re
import os
  import commands
  import subprocess as commands
import sys
from alibuild_helpers.utilities import format, detectArch
from alibuild_helpers.utilities import normalise_multiple_options
from os.path import abspath, dirname, basename


try:
except ImportError:

# Default workdir: fall back on "sw" if env is not set or empty
DEFAULT_WORK_DIR = os.environ.get("ALIBUILD_WORK_DIR") or os.environ.get("ALICE_WORK_DIR") or "sw"

# cd to this directory before start
DEFAULT_CHDIR = os.environ.get("ALIBUILD_CHDIR") or "."

def csv_list(s):
  return s.split(',')


# This is syntactic sugar for the --dist option (which should really be called
# --dist-tag). It can be either:
# - A tag name
# - A repository spec in the for org/repo@tag
def alidist_string(s, star):
  repo, have_repo_spec, ver = s.partition("@")

# Path: alibuild_helpers/utilities.py
# def format(s, **kwds):
#   if sys.version_info[0] >= 3:
#     if isinstance(s, bytes):
#       try:
#         s = s.decode("utf-8")  # to get newlines as such and not as escaped \n
#       except:
#         s = s.decode("latin-1")  # Workaround issue with some special characters of latin-1 which are not understood by unicode
#     else:
#       s = str(s)
#   elif isinstance(s, str):
#     s = unicode(s, "utf-8")  # utf-8 is a safe assumption
#   elif not isinstance(s, unicode):
#     s = unicode(str(s))
#   return s % kwds
# 
# def detectArch():
#   try:
#     with open("/etc/os-release") as osr:
#       osReleaseLines = osr.readlines()
#     hasOsRelease = True
#   except (IOError,OSError):
#     osReleaseLines = []
#     hasOsRelease = False
#   try:
#     import platform
#     if platform.system() == "Darwin":
#       if platform.machine() == "x86_64":
#         return "osx_x86-64"
#       else:
#         return "osx_arm64"
#   except:
#     pass
#   try:
#     import platform, distro
#     platformTuple = distro.linux_distribution()
#     platformSystem = platform.system()
#     platformProcessor = platform.processor()
#     if not platformProcessor or " " in platformProcessor:
#       platformProcessor = platform.machine()
#     return doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, platformProcessor)
#   except:
#     return doDetectArch(hasOsRelease, osReleaseLines, ["unknown", "", ""], "", "")
# 
# Path: alibuild_helpers/utilities.py
# def normalise_multiple_options(option, sep=","):
#   return [x for x in ",".join(option).split(sep) if x]


# Path: alibuild_helpers/args.py
import argparse
import multiprocessing
import re
import os
  import commands
  import subprocess as commands
import sys
from alibuild_helpers.utilities import format, detectArch
from alibuild_helpers.utilities import normalise_multiple_options
from os.path import abspath, dirname, basename



try:
except ImportError:

# Default workdir: fall back on "sw" if env is not set or empty
DEFAULT_WORK_DIR = os.environ.get("ALIBUILD_WORK_DIR") or os.environ.get("ALICE_WORK_DIR") or "sw"

# cd to this directory before start
DEFAULT_CHDIR = os.environ.get("ALIBUILD_CHDIR") or "."

def csv_list(s):
  return s.split(',')


# This is syntactic sugar for the --dist option (which should really be called
# --dist-tag). It can be either:
# - A tag name
# - A repository spec in the for org/repo@tag
def alidist_string(s, star):
  repo, have_repo_spec, ver = s.partition("@")

  if not have_repo_spec: