for root, dirs, files in os.walk('.', topdown=False):
    for name in files:
        if name.startswith('myext') and not (name.endswith('.pyx') or name.
            endswith('.pxd')):
            os.remove(os.path.join(root, name))
for name in dirs:
    if name == 'build':
        shutil.rmtree(name)
setup(cmdclass={'build_ext': build_ext}, ext_modules=[Extension('myext',
    sources=['myext.pyx', 'SomeAdditionalCppClass1.cpp',
    'SomeAdditionalCppClass2.cpp'], libraries=['externlib'], language='c++',
    extra_compile_args=['-fopenmp', '-O3'], extra_link_args=[
    '-DSOME_DEFINE_OPT', '-L./some/extra/dependency/dir/'])])
Using Cython To Link Python To A Shared Library