from SCons.Script import *


def generate(env):
    env.SetDefault(RUN_DISTUTILS = 'python')
    env.SetDefault(RUN_DISTUTILSOPTS = 'build')

    env['RUN_DISTUTILS'] = 'python'
    env['RUN_DISTUTILSOPTS'] = 'build'

    bld = Builder(action = '$RUN_DISTUTILS $SOURCE $RUN_DISTUTILSOPTS')
    env.Append(BUILDERS = {'RunDistUtils' : bld})


def exists():
    return 1

from SCons.Script import *
import os


def generate(env):
    env.SetDefault(RUN_DISTUTILS = 'python')
    env.SetDefault(RUN_DISTUTILSOPTS = 'build')

    if 'RUN_DISTUTILS' in os.environ:
        env['RUN_DISTUTILS'] = os.environ['RUN_DISTUTILS']
    if 'RUN_DISTUTILSOPTS' in os.environ:
        env['RUN_DISTUTILSOPTS'] = os.environ['RUN_DISTUTILSOPTS']

    bld = Builder(action = '$RUN_DISTUTILS $SOURCE $RUN_DISTUTILSOPTS')
    env.Append(BUILDERS = {'RunDistUtils' : bld})


def exists():
    return 1

Allow env vars for RUN_DISTUTILS
Allow env vars for RUN_DISTUTILS

Allow use of env vars RUN_DISTUTILS, RUN_DISTUTILOPTS as defaults.

With this, on macos, macports doesn't need to be in PATH to build FAHControl. One just needs

export RUN_DISTUTILS="/opt/local/bin/python"

or the equivalent in dockbot.json env.

  from SCons.Script import *
+ import os
  
  
  def generate(env):
      env.SetDefault(RUN_DISTUTILS = 'python')
      env.SetDefault(RUN_DISTUTILSOPTS = 'build')
  
-     env['RUN_DISTUTILS'] = 'python'
-     env['RUN_DISTUTILSOPTS'] = 'build'
+     if 'RUN_DISTUTILS' in os.environ:
+         env['RUN_DISTUTILS'] = os.environ['RUN_DISTUTILS']
+     if 'RUN_DISTUTILSOPTS' in os.environ:
+         env['RUN_DISTUTILSOPTS'] = os.environ['RUN_DISTUTILSOPTS']
  
      bld = Builder(action = '$RUN_DISTUTILS $SOURCE $RUN_DISTUTILSOPTS')
      env.Append(BUILDERS = {'RunDistUtils' : bld})
  
  
  def exists():
      return 1
  
Allow env vars for RUN_DISTUTILS
## Code Before:
from SCons.Script import *


def generate(env):
    env.SetDefault(RUN_DISTUTILS = 'python')
    env.SetDefault(RUN_DISTUTILSOPTS = 'build')

    env['RUN_DISTUTILS'] = 'python'
    env['RUN_DISTUTILSOPTS'] = 'build'

    bld = Builder(action = '$RUN_DISTUTILS $SOURCE $RUN_DISTUTILSOPTS')
    env.Append(BUILDERS = {'RunDistUtils' : bld})


def exists():
    return 1

## Instruction:
Allow env vars for RUN_DISTUTILS
## Code After:
from SCons.Script import *
import os


def generate(env):
    env.SetDefault(RUN_DISTUTILS = 'python')
    env.SetDefault(RUN_DISTUTILSOPTS = 'build')

    if 'RUN_DISTUTILS' in os.environ:
        env['RUN_DISTUTILS'] = os.environ['RUN_DISTUTILS']
    if 'RUN_DISTUTILSOPTS' in os.environ:
        env['RUN_DISTUTILSOPTS'] = os.environ['RUN_DISTUTILSOPTS']

    bld = Builder(action = '$RUN_DISTUTILS $SOURCE $RUN_DISTUTILSOPTS')
    env.Append(BUILDERS = {'RunDistUtils' : bld})


def exists():
    return 1
