Esempio n. 1
0
def setup_keywords(dist):
    """Create libcarefree_objects data file lists
       and add to setup keywords.
    """
    import zcons

    PYTHON_SHORT_VERSION = '%i%i' % tuple(sys.version_info[:2])

    LIB_PACKAGE = 'libcfo'
    LIB_PACKAGE_DIR = '.'
    # Also gets the lib/header files if building an egg
    LIB_PACKAGE_DATA = ['VERSION', 'requirements.txt']
    # Gets the lib/header files for installing to sys.prefix
    # if doing normal build/install
    LIB_DATA_FILES = []

    LIB_PACKAGES = [LIB_PACKAGE]

    try:
        import libarray_ptr
    except ImportError:
        pass
    else:
        os.environ['CPPFLAGS'] = '-I%s %s' % (str(
            libarray_ptr.INCLUDE_PATH), os.environ.get('CPPFLAGS', ''))

    # Process the header templates and compile the libs
    env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
    # for cmd in [
    #         ## ['scons', '-c', 'SHARED=yes', 'STATIC=yes'],
    #         ['scons', 'DEBUG=yes', 'SHARED=yes', 'STATIC=yes', 'TESTS=yes'],
    #         ## 'PYTHON=%s' % sys.executable],
    # ]:
    #     print(' '.join(cmd))
    #     if Popen(cmd, env=env).wait():
    #         sys.exit(1)
    zcons.scons(env_update=env,
                stdout=sys.__stderr__,
                DEBUG=True,
                SHARED=True,
                STATIC=True)

    LIB_PACKAGE_DIR = Path(LIB_PACKAGE_DIR)

    if 'install' in sys.argv:
        PREFIX = Path(sys.prefix).abspath()
        # Store sys.prefix location (where data_files are installed)
        # as part of package_data.
        # Can later be accessed with libcarefree_objects.PREFIX
        with open('PREFIX', 'w') as f:
            f.write(PREFIX)
        LIB_PACKAGE_DATA.append('PREFIX')

    INCLUDE_FILES = []
    with Path('include'):
        for dirpath, dirnames, filenames in os.walk('.'):
            if filenames:
                abspath = Path(dirpath).abspath()
                INCLUDE_FILES.append(
                    (dirpath, [abspath / fn for fn in filenames]))

    LIB_FILES = []
    with Path('lib'):
        for suffix in [
                'types',
                'python-py%s' % PYTHON_SHORT_VERSION,
        ]:
            LIB_FILES.extend(
                Path('libcarefree-%s.%s' % (suffix, ext)).abspath()
                for ext in ('a', 'so'))

    if 'install' in sys.argv:
        # Install libs/headers as data_files to sys.prefix
        for dirpath, filenames in INCLUDE_FILES:
            LIB_DATA_FILES.append((PREFIX / 'include' / dirpath, filenames))
        LIB_DATA_FILES.append((PREFIX / 'lib', LIB_FILES))
    else:
        # Install libs/headers as package_data
        for dirpath, filepaths in INCLUDE_FILES:
            for path in filepaths:
                LIB_PACKAGE_DATA.append(LIB_PACKAGE_DIR.relpathto(path))
        for path in LIB_FILES:
            LIB_PACKAGE_DATA.append(LIB_PACKAGE_DIR.relpathto(path))

    dist.package_dir[LIB_PACKAGE] = LIB_PACKAGE_DIR
    dist.packages = list(dist.packages) + LIB_PACKAGES

    if 'sdist' not in sys.argv:
        dist.package_data = {
            'cfo.jinja.macros': [
                'cfo',
            ],
            LIB_PACKAGE: LIB_PACKAGE_DATA,
        }
        dist.data_files = LIB_DATA_FILES
Esempio n. 2
0
        env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
        try:
            import libarray_ptr
        except ImportError:
            pass
        else:
            env['CPPFLAGS'] = '-I%s %s' % (str(
                libarray_ptr.INCLUDE_PATH), env.get('CPPFLAGS', ''))
        # if Popen(['scons', 'DEBUG=yes', 'SHARED=yes', 'STATIC=yes',
        #           'TESTS=yes'],
        #          env=env).wait():
        #     raise RuntimeError
        zcons.scons(env_update=env,
                    stdout=sys.__stderr__,
                    DEBUG=True,
                    SHARED=True,
                    STATIC=True)
        del env

INCLUDE_PATH = PREFIX / 'include'

LIB_PATH = PREFIX / 'lib'


def setup_keywords(dist):
    """Create libcarefree_objects data file lists
       and add to setup keywords.
    """
    import zcons
Esempio n. 3
0
def setup_keywords(dist):
    """Create libcarefree_objects data file lists
       and add to setup keywords.
    """
    import zcons

    PYTHON_SHORT_VERSION = '%i%i' % tuple(sys.version_info[:2])

    LIB_PACKAGE = 'libcfo'
    LIB_PACKAGE_DIR = '.'
    # Also gets the lib/header files if building an egg
    LIB_PACKAGE_DATA = ['VERSION', 'requirements.txt']
    # Gets the lib/header files for installing to sys.prefix
    # if doing normal build/install
    LIB_DATA_FILES = []

    LIB_PACKAGES = [LIB_PACKAGE]

    try:
        import libarray_ptr
    except ImportError:
        pass
    else:
        os.environ['CPPFLAGS'] = '-I%s %s' % (
          str(libarray_ptr.INCLUDE_PATH), os.environ.get('CPPFLAGS', ''))

    # Process the header templates and compile the libs
    env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
    # for cmd in [
    #         ## ['scons', '-c', 'SHARED=yes', 'STATIC=yes'],
    #         ['scons', 'DEBUG=yes', 'SHARED=yes', 'STATIC=yes', 'TESTS=yes'],
    #         ## 'PYTHON=%s' % sys.executable],
    # ]:
    #     print(' '.join(cmd))
    #     if Popen(cmd, env=env).wait():
    #         sys.exit(1)
    zcons.scons(env_update=env, DEBUG=True, SHARED=True, STATIC=True)

    LIB_PACKAGE_DIR = Path(LIB_PACKAGE_DIR)

    if 'install' in sys.argv:
        PREFIX = Path(sys.prefix).abspath()
        # Store sys.prefix location (where data_files are installed)
        # as part of package_data.
        # Can later be accessed with libcarefree_objects.PREFIX
        with open('PREFIX', 'w') as f:
            f.write(PREFIX)
        LIB_PACKAGE_DATA.append('PREFIX')

    INCLUDE_FILES = []
    with Path('include'):
        for dirpath, dirnames, filenames in os.walk('.'):
            if filenames:
                abspath = Path(dirpath).abspath()
                INCLUDE_FILES.append((dirpath, [
                  abspath / fn for fn in filenames]))

    LIB_FILES = []
    with Path('lib'):
        for suffix in [
          'types',
          'python-py%s' % PYTHON_SHORT_VERSION,
          ]:
            LIB_FILES.extend(
              Path('libcarefree-%s.%s' % (suffix, ext)
                   ).abspath()
              for ext in ('a', 'so'))

    if 'install' in sys.argv:
        # Install libs/headers as data_files to sys.prefix
        for dirpath, filenames in INCLUDE_FILES:
            LIB_DATA_FILES.append(
              (PREFIX / 'include' / dirpath, filenames))
        LIB_DATA_FILES.append((PREFIX / 'lib', LIB_FILES))
    else:
        # Install libs/headers as package_data
        for dirpath, filepaths in INCLUDE_FILES:
            for path in filepaths:
                LIB_PACKAGE_DATA.append(LIB_PACKAGE_DIR.relpathto(path))
        for path in LIB_FILES:
            LIB_PACKAGE_DATA.append(LIB_PACKAGE_DIR.relpathto(path))

    dist.package_dir[LIB_PACKAGE] = LIB_PACKAGE_DIR
    dist.packages = list(dist.packages) + LIB_PACKAGES

    if 'sdist' not in sys.argv:
        dist.package_data = {
          'cfo.jinja.macros': [
            'cfo',
            ],
          LIB_PACKAGE: LIB_PACKAGE_DATA,
          }
        dist.data_files = LIB_DATA_FILES
Esempio n. 4
0
    if Path('SConstruct').exists():
        import zcons

        env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
        try:
            import libarray_ptr
        except ImportError:
            pass
        else:
            env['CPPFLAGS'] = '-I%s %s' % (
                str(libarray_ptr.INCLUDE_PATH), env.get('CPPFLAGS', ''))
        # if Popen(['scons', 'DEBUG=yes', 'SHARED=yes', 'STATIC=yes',
        #           'TESTS=yes'],
        #          env=env).wait():
        #     raise RuntimeError
        zcons.scons(env_update=env, DEBUG=True, SHARED=True, STATIC=True)
        del env


INCLUDE_PATH = PREFIX / 'include'

LIB_PATH = PREFIX / 'lib'


def setup_keywords(dist):
    """Create libcarefree_objects data file lists
       and add to setup keywords.
    """
    import zcons

    PYTHON_SHORT_VERSION = '%i%i' % tuple(sys.version_info[:2])
Esempio n. 5
0
def run():
    """Entry point for ``zcons`` command line script.

    - Calls :func:`zcons.scons` with ``sys.argv[1:]`` as arguments.
    """
    zcons.scons(*sys.argv[1:])
Esempio n. 6
0
    if Path('SConstruct').exists():
        import zcons

        env = dict(os.environ, PYTHONPATH=os.pathsep.join(sys.path))
        try:
            import libarray_ptr
        except ImportError:
            pass
        else:
            env['CPPFLAGS'] = '-I%s %s' % (
                str(libarray_ptr.INCLUDE_PATH), env.get('CPPFLAGS', ''))
        # if Popen(['scons', 'DEBUG=yes', 'SHARED=yes', 'STATIC=yes',
        #           'TESTS=yes'],
        #          env=env).wait():
        #     raise RuntimeError
        zcons.scons(env_update=env, stdout=sys.__stderr__,
                    DEBUG=True, SHARED=True, STATIC=True)
        del env


INCLUDE_PATH = PREFIX / 'include'

LIB_PATH = PREFIX / 'lib'


def setup_keywords(dist):
    """Create libcarefree_objects data file lists
       and add to setup keywords.
    """
    import zcons

    PYTHON_SHORT_VERSION = '%i%i' % tuple(sys.version_info[:2])