Skip to content
Snippets Groups Projects
  1. Feb 26, 2019
  2. Feb 25, 2019
  3. Feb 22, 2019
  4. Feb 21, 2019
  5. Feb 16, 2019
  6. Feb 14, 2019
  7. Feb 13, 2019
  8. Jan 31, 2019
  9. Jan 11, 2019
  10. Jan 10, 2019
    • Michal Vyskocil's avatar
      P: cffi must be compatible with 3.2 · d2065033e33b
      Michal Vyskocil authored
      S: can't use u prefixes, as it is syntax error there
      d2065033e33b
    • Michal Vyskocil's avatar
      Define and raise specific hierarchy of exceptions · 93d6970fc206
      Michal Vyskocil authored
      * PkgConfigNotFound             - not installed
      * PkgConfigError                - base pkg-config errors
          * PkgConfigModuleNotFound   - pc file for module was not found
          * PkgConfigModuleVersionNotFound - requested version was not found
      
      Boilerplate now looks
      ```
      from cffi.error import PkgConfigNotFound, PkgConfigError
      ...
      try:
          # try pkg-config way
          ffibuilder.set_source(..., pkgconfig=["libczmq >= 4.0.0"])
      except PkgConfigNotFound as e:
          # if pkg-config is not installed, try backup
          ffibuilder.set_source(..., libraries=["czmq", "zmq", "uuid", "pgm"])
      except PkgConfigError as e:
          # here we catch both PkgConfigModuleNotFound and PkgConfigModuleVersionNotFound
          # and raise it again - simply to show they are raised
          raise e from None
      ```
      93d6970fc206
  11. Jan 09, 2019
    • Michal Vyskocil's avatar
      Document version pinning for pkgconfig · 59a7c949248b
      Michal Vyskocil authored
      59a7c949248b
    • Michal Vyskocil's avatar
      Exception based flow · 58d9217d4315
      Michal Vyskocil authored
      Now the with non pkg-config backup would be
      ```
      module_name = "_czmq"
      source = "#include <czmq.h>"
      try:
          print(f"### pkg-config path")
          ffibuilder.set_source(
              module_name,
              source,
              pkgconfig=["libczmq"]
          )
      except Exception as e:
          print(f"Exception e: {e}")
          ffibuilder.set_source(
              module_name,
              source,
              libraries=["czmq"]
          )
      ```
      58d9217d4315
  12. Jan 08, 2019
    • Michal Vyskocil's avatar
      428261c7ae2c
    • Michal Vyskocil's avatar
      Real test of a pkgconfig integration · e0251d298a40
      Michal Vyskocil authored
      Fix encoding errors
      
      Given testing Python program
      ```
      from cffi import FFI
      ffibuilder = FFI()
      
      ffibuilder.cdef(
          "char* zsys_hostname();"
      )
      
      ffibuilder.set_source(
          "_czmq",
          "#include <czmq.h>",
          pkgconfig=["libczmq"]
      )
      
      
      if __name__ == "__main__":
          ffibuilder.compile(verbose=True)
      ```
      
      We can run ffibuilder from source dir of czmq
      
      ```
      PKG_CONFIG_PATH=`pwd`/src python3 t.py
      generating ./_czmq.c
      ...
      gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none ./_czmq.o -L/usr/local/lib64 -L/usr/lib64 -lczmq -lzmq -lpython3.6m -o ./_czmq.cpython-36m-x86_64-linux-gnu.so
      ```
      
      ```
      python3 t.py
      generating ./_czmq.c
      ...
      gcc -pthread -shared -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none ./_czmq.o -L/usr/lib64 -lczmq -lpython3.6m -o ./_czmq.cpython-36m-x86_64-linux-gnu.so
      ```
      
      Note that in the first case `/usr/local` has been added to the compiler path as
      provided by local pkg-config file.
      e0251d298a40
    • Michal Vyskocil's avatar
      merge with latest tip · 48ca9a578dac
      Michal Vyskocil authored
      48ca9a578dac
    • Michal Vyskocil's avatar
      Increase testing coverage and refactor method names · 09ffc07bbde2
      Michal Vyskocil authored
      Making `pkgconfig.call` function accessible, tests can monkey patch it and
      provide mock. This improves testing, however raised a need to give
      functions better names than `pkgconfig.pkgconfig_kwargs` or `pkgconfig.pc`.
      09ffc07bbde2
Loading