示例#1
0
#!/usr/bin/env python2
from os import path
import distutils

site_packages = distutils.sysconfig_get_python_lib()
target = path.join(site_packages, 'usercustomize.py')

content = "import sys\nsys.dont_write_bytecode = True\n"

if path.exists(target):
    with open(target) as fp:
        if content not in fp.read():
            print('{target!r} has unexpected content'.format(target=target))
            print('please open the file and add the following:')
            print(content)
            print("# end")
else:
    with open(target, 'w') as fp:
        fp.write(content)
示例#2
0
from distutils.core import setup, Extension
import distutils
import platform
import os

extra_link_args = []
runtime_library_dirs = []
lib_name_prefix = ''
if platform.system() == 'Darwin':
    extra_link_args.append(
        '-Wl,-rpath,' +
        os.path.join(distutils.sysconfig_get_python_lib(), 'pylibui'))
elif platform.system() == 'Linux':
    runtime_library_dirs.append('$ORIGIN')
elif platform.system() == 'Windows':
    lib_name_prefix = 'lib'

libui_module = Extension('pylibui._libui', ['pylibui/libui.i'],
                         libraries=[lib_name_prefix + 'ui'],
                         runtime_library_dirs=runtime_library_dirs,
                         extra_link_args=extra_link_args)

setup(name='pylibui',
      version='0.0.1',
      ext_modules=[libui_module],
      description='Python wrapper for libui',
      packages=['pylibui', 'pylibui.controls'])