Ejemplo n.º 1
0
    line = re.sub(r'^(\s*from awlsim[0-9a-zA-Z_]*)\.([0-9a-zA-Z_\.]+) import',
                  r'\1_cython.\2 import', line)
    line = re.sub(r'^(\s*from awlsim[0-9a-zA-Z_]*)\.([0-9a-zA-Z_\.]+) cimport',
                  r'\1_cython.\2 cimport', line)
    line = re.sub(r'^(\s*import awlsim[0-9a-zA-Z_]*)\.', r'\1_cython.', line)
    line = re.sub(r'^(\s*cimport awlsim[0-9a-zA-Z_]*)\.', r'\1_cython.', line)
    return line


setup_cython.pyCythonPatchLine = pyCythonPatchLine

cmdclass = {}

# Try to build the Cython modules. This might fail.
if buildCython:
    buildCython = setup_cython.cythonBuildPossible()
if buildCython:
    cmdclass["build_ext"] = setup_cython.CythonBuildExtension
    setup_cython.registerCythonModules()
else:
    print("Skipping build of CYTHON modules.")

ext_modules = setup_cython.ext_modules
extraKeywords = {}

# Workaround for mbcs codec bug in distutils
# http://bugs.python.org/issue10945
import codecs
try:
    codecs.lookup("mbcs")
except LookupError:
Ejemplo n.º 2
0
def pyCythonPatchLine(line):
	# Patch the import statements
	line = re.sub(r'^(\s*from pyprofibus[0-9a-zA-Z_]*)\.([0-9a-zA-Z_\.]+) import', r'\1_cython.\2 import', line)
	line = re.sub(r'^(\s*from pyprofibus[0-9a-zA-Z_]*)\.([0-9a-zA-Z_\.]+) cimport', r'\1_cython.\2 cimport', line)
	line = re.sub(r'^(\s*import pyprofibus[0-9a-zA-Z_]*)\.', r'\1_cython.', line)
	line = re.sub(r'^(\s*cimport pyprofibus[0-9a-zA-Z_]*)\.', r'\1_cython.', line)
	return line

setup_cython.pyCythonPatchLine = pyCythonPatchLine

cmdclass = {}

# Try to build the Cython modules. This might fail.
if buildCython:
	buildCython = setup_cython.cythonBuildPossible()
if buildCython:
	cmdclass["build_ext"] = setup_cython.CythonBuildExtension
	setup_cython.registerCythonModules()
else:
	print("Skipping build of CYTHON modules.")

ext_modules = setup_cython.ext_modules


warnings.filterwarnings("ignore", r".*'long_description_content_type'.*")

with open(os.path.join(basedir, "README.md"), "rb") as fd:
	readmeText = fd.read().decode("UTF-8")

setup(	name		= "pyprofibus",
Ejemplo n.º 3
0
def pyCythonPatchLine(line):
    # Patch the import statements
    line = re.sub(r'^(\s*from awlsim[0-9a-zA-Z_]*)\.([0-9a-zA-Z_\.]+) import',
                  r'\1_cython.\2 import', line)
    line = re.sub(r'^(\s*from awlsim[0-9a-zA-Z_]*)\.([0-9a-zA-Z_\.]+) cimport',
                  r'\1_cython.\2 cimport', line)
    line = re.sub(r'^(\s*import awlsim[0-9a-zA-Z_]*)\.', r'\1_cython.', line)
    line = re.sub(r'^(\s*cimport awlsim[0-9a-zA-Z_]*)\.', r'\1_cython.', line)
    return line


os.environ["CFLAGS"] = os.environ["CXXFLAGS"] = "-O0"
os.environ["CPPFLAGS"] = ""
os.environ["LDFLAGS"] = ""
if not setup_cython.cythonBuildPossible():
    print("ERROR: Cannot build Cython modules.", file=sys.stderr)
    sys.exit(1)
cmdclass = {}
cmdclass["build_ext"] = setup_cython.CythonBuildExtension
setup_cython.setupFileName = os.path.basename(__file__)
setup_cython.parallelBuild = True
setup_cython.pyCythonPatchLine = pyCythonPatchLine
setup_cython.registerCythonModules()
ext_modules = setup_cython.ext_modules

# Create links to the awlsim packages.
awlsimBuildPatchDir = os.path.join("..", "build", setup_cython.patchDirName)
if not os.path.isdir(awlsimBuildPatchDir):
    print(("Awlsim build directory '%s' does not exist.\n"
           "Has awlsim been built?") % awlsimBuildPatchDir,