How to use the cppimport.find function in cppimport

To help you get started, we’ve selected a few cppimport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tbenthompson / cppimport / tests / test_cppimport.py View on Github external
def test_find_module_cpppath():
    mymodule_loc = cppimport.find.find_module_cpppath("mymodule")
    mymodule_dir = os.path.dirname(mymodule_loc)
    assert(os.path.basename(mymodule_loc) == "mymodule.cpp")

    apackage = cppimport.find.find_module_cpppath("apackage.mymodule")
    apackage_correct = os.path.join(mymodule_dir, 'apackage', 'mymodule.cpp')
    assert(apackage == apackage_correct)

    inner = cppimport.find.find_module_cpppath("apackage.inner.mymodule")
    inner_correct = os.path.join(mymodule_dir, 'apackage', 'inner', 'mymodule.cpp')
    assert(inner == inner_correct)
github tbenthompson / cppimport / tests / test_cppimport.py View on Github external
def test_find_module_cpppath():
    mymodule_loc = cppimport.find.find_module_cpppath("mymodule")
    mymodule_dir = os.path.dirname(mymodule_loc)
    assert(os.path.basename(mymodule_loc) == "mymodule.cpp")

    apackage = cppimport.find.find_module_cpppath("apackage.mymodule")
    apackage_correct = os.path.join(mymodule_dir, 'apackage', 'mymodule.cpp')
    assert(apackage == apackage_correct)

    inner = cppimport.find.find_module_cpppath("apackage.inner.mymodule")
    inner_correct = os.path.join(mymodule_dir, 'apackage', 'inner', 'mymodule.cpp')
    assert(inner == inner_correct)
github tbenthompson / cppimport / cppimport / importer.py View on Github external
def imp(fullname, opt_in = False):
    # Search through sys.path to find a file that matches the module
    filepath = cppimport.find.find_module_cpppath(fullname, opt_in)
    return imp_from_filepath(filepath, fullname)