예제 #1
0
use this standard. For more info, contact either of us.

""".lstrip()
with open(os.path.join(distDir, '_settings', 'README.txt'), 'wb') as file:
    file.write(SETTINGS_TEXT.encode('utf-8'))



## Post processing


# Set search path of dynamic libraries
import dllutils
if sys.platform.startswith('linux'):
    # Exe
    dllutils.set_search_path(os.path.join(distDir, 'pyzo'), '', 'lib')
    # Libs
    os.mkdir(os.path.join(distDir, 'lib'))
    for entry in os.listdir(distDir):
        filename = os.path.join(distDir, entry)
        if not os.path.isfile(filename):
            continue
        if not (entry.endswith('.so') or '.so.' in entry):
            continue
        #
        rpaths = '', 'lib'
        if entry.startswith('lib') and not 'python' in entry:
            filename = os.path.join(distDir, 'lib', entry)
            shutil.move(os.path.join(distDir, entry), filename)
            rpaths = '', '..'
        try:
예제 #2
0
This "standard" was discussed between the authors of WinPython,
PortablePython and Pyzo. Developers can use the appdata_dir() function
from https://bitbucket.org/pyzo/pyzolib/src/tip/paths.py to
use this standard. For more info, contact either of us.

""".lstrip()
with open(os.path.join(distDir, '_settings', 'README.txt'), 'wb') as file:
    file.write(SETTINGS_TEXT.encode('utf-8'))

## Post processing

# Set search path of dynamic libraries
import dllutils
if sys.platform.startswith('linux'):
    # Exe
    dllutils.set_search_path(os.path.join(distDir, 'pyzo'), '', 'lib')
    # Libs
    os.mkdir(os.path.join(distDir, 'lib'))
    for entry in os.listdir(distDir):
        filename = os.path.join(distDir, entry)
        if not os.path.isfile(filename):
            continue
        if not (entry.endswith('.so') or '.so.' in entry):
            continue
        #
        rpaths = '', 'lib'
        if entry.startswith('lib') and not 'python' in entry:
            filename = os.path.join(distDir, 'lib', entry)
            shutil.move(os.path.join(distDir, entry), filename)
            rpaths = '', '..'
        try:
예제 #3
0
    # Libs further (newer version of cx_freeze puts libs in /lib/python3.5
    qt_platform_dir = os.path.join(distDir, 'platforms')
    if not os.path.isdir(qt_platform_dir):
        print('Could not find Qt platform dir')
    else:
        for entry in os.listdir(qt_platform_dir):
            filename = os.path.join(qt_platform_dir, entry)
            if not (os.path.isfile(filename ) and (entry.endswith('.so') or '.so.' in entry)):
                continue
            rpaths = '', '..', '../lib', '../lib/python' + sys.version[:3]
        libs2fix.append((filename, rpaths))
    
    # Apply
    for filename, rpaths in libs2fix:
        try:
            dllutils.set_search_path(filename, *rpaths)
        except Exception as err:
            print('Cannot set search path of %s:\n%s' % 
                    (os.path.basename(entry), str(err)))


if sys.platform.startswith('linux'):
    
    # Set qt.conf
    # Prevent loading plugins form the system plugin dir, which
    # may cause incompatibility conflicts. This complements the call
    # QApplication.setLibraryPaths([]), it does not replace it.
    # See issue 138 and issue 198.
    with open(os.path.join(distDir, 'qt.conf'), 'wb') as file:
        file.write("[Paths]\nPlugins = '.'\n".encode('utf-8'))