{ "info": { "author": "Pawe\u0142 Tomulik", "author_email": "ptomulik@meil.pw.edu.pl", "bugtrack_url": null, "classifiers": [], "description": "scons-tool-swigpy\n=================\n\n.. image:: https://badge.fury.io/py/scons-tool-swigpy.svg\n :target: https://badge.fury.io/py/scons-tool-swigpy\n :alt: PyPi package version\n\n.. image:: https://travis-ci.org/ptomulik/scons-tool-swigpy.svg?branch=master\n :target: https://travis-ci.org/ptomulik/scons-tool-swigpy\n :alt: Travis CI build status\n\n.. image:: https://ci.appveyor.com/api/projects/status/github/ptomulik/scons-tool-swigpy?svg=true\n :target: https://ci.appveyor.com/project/ptomulik/scons-tool-swigpy\n\nSCons_ tool to generate Python modules using Swig_.\n\nInstallation\n------------\n\nThere are few ways to install this tool for your project.\n\nFrom pypi_\n^^^^^^^^^^\n\nThis method may be preferable if you build your project under a virtualenv. To\nadd swigpy tool from pypi_, type (within your wirtualenv):\n\n.. code-block:: shell\n\n pip install scons-tool-loader scons-tool-swigpy\n\nor, if your project uses pipenv_:\n\n.. code-block:: shell\n\n pipenv install --dev scons-tool-loader scons-tool-swigpy\n\nAlternatively, you may add this to your ``Pipfile``\n\n.. code-block::\n\n [dev-packages]\n scons-tool-loader = \"*\"\n scons-tool-swigpy = \"*\"\n\n\nThe tool will be installed as a namespaced package ``sconstool.swigpy``\nin project's virtual environment. You may further use scons-tool-loader_\nto load the tool.\n\nAs a git submodule\n^^^^^^^^^^^^^^^^^^\n\n#. Create new git repository:\n\n .. code-block:: shell\n\n mkdir /tmp/prj && cd /tmp/prj\n touch README.rst\n git init\n\n#. Add the `scons-tool-swigpy`_ as a submodule:\n\n .. code-block:: shell\n\n git submodule add git://github.com/ptomulik/scons-tool-swigpy.git site_scons/site_tools/swigpy\n\n#. For python 2.x create ``__init__.py`` in ``site_tools`` directory:\n\n .. code-block:: shell\n\n touch site_scons/site_tools/__init__.py\n\n this will allow to directly import ``site_tools.swigpy`` (this may be required by other tools).\n\nUsage example\n-------------\n\nGit-based projects\n^^^^^^^^^^^^^^^^^^\n\n#. Create some source files, for example ``src/hello.hpp`` and\n ``src/hello.cpp``:\n\n .. code-block:: cpp\n\n // src/hello.hpp\n #ifndef HELLO_HPP\n #define HELLO_HPP\n void hello();\n #endif\n\n .. code-block:: cpp\n\n // src/hello.cpp\n #include \"hello.hpp\"\n #include \n void hello() { std::cout << \"Hello\" << std::endl; }\n\n#. Create swig interface file ``src/hello.i``\n\n .. code-block:: swig\n\n // src/hello.i\n %module hello;\n %{\n #include \"hello.hpp\"\n %}\n %include \"hello.hpp\"\n\n#. Write ``SConstruct`` file:\n\n .. code-block:: python\n\n\n # SConstruct\n env = Environment(tools = [ 'default', 'swigpy' ])\n SConscript('src/SConscript', exports=['env'], variant_dir='build', duplicate=0)\n\n#. Write ``src/SConscript``:\n\n .. code-block:: python\n\n # src/SConscript\n Import(['env'])\n env.Append( SWIGPY_CPPPATH = ['.'] )\n env.Append( SWIGPY_LIBPATH = ['.'] )\n env.Append( SWIGPY_SWIGFLAGS = ['-c++'] )\n env.SharedLibrary( 'hello', ['hello.cpp'] )\n env.SwigPyModule( 'hello', SWIGPY_LIBS = ['$SWIGPY_PYTHONLIB', 'hello'] )\n\n#. Try it out:\n\n .. code-block:: shell\n\n scons\n\n This shall create a library **build/libhello.so** and all the files that\n comprise its python wrapper:\n\n .. code-block:: shell\n\n ptomulik@tea:$ ls build/\n hello.os hello.pyc hello_wrap.cc libhello.so\n hello.py _hello.so hello_wrap.os\n\n\n#. Test the generated wrapper:\n\n .. code-block:: shell\n\n cd build\n LD_LIBRARY_PATH='.' python\n >>> import hello\n >>> hello.hello()\n\nDetails\n-------\n\nModule description\n^^^^^^^^^^^^^^^^^^\n\nThe module provides a ``SwigPyModule()`` builder which generates python module\nbased on a swig interface ``*.i`` file::\n\n SwigPyModule(modname, **overrides)\n\nThe **modname** is a name of the module being generated, for example ``'foo'``\nor ``'foo.bar'`` (note, it's neither the source file name nor target file\nname). The **overrides** overwrite construction variables such as ``SWIGFLAGS``\nor ``CFLAGS``.\n\n**Example 1**:\n\nThe following code expects a ``foo.i`` interface file to be present and\ngenerates python module defined by this file.\n\n.. code-block:: python\n\n SwigPyModule('foo')\n\n**Example 2**:\n\nThe following code expects a ``foo/bar.i`` interface file to be present\nand generates python module defined by this file undef ``foo`` subdirectory.\n\n.. code-block:: python\n\n SwigPyModule('foo.bar')\n\nConstruction variables\n^^^^^^^^^^^^^^^^^^^^^^\n\nConstruction variables used by ``SwigPyModule`` are summarized in the following\ntable. Note that there are two groups of variables. The first group are the\nwell known variables such as ``CFLAGS`` or ``SWIGFLAGS``. The second group are\nthe variables prefixed with ``SWIGPY_``. These variables, if defined, overwrite\nthe well known variables when generating python bindings.\n\n========================= =============================================\nVariable Default\n========================= =============================================\nSWIG\nSWIGVERSION\nSWIGFLAGS\nSWIGDIRECTORSUFFIX\nSWIGCFILESUFFIX\nSWIGCXXFILESUFFIX\nSWIGPATH\nSWIGINCPREFIX\nSWIGINCSUFFIX\nSWIGCOM\nCPPPATH\nSHLIBPREFIX\nCCFLAGS\nCFLAGS\nCXXFLAGS\nLIBS\nLIBPATH\nLDFLAGS\nSWIGPY_SWIG\nSWIGPY_SWIGVERSION\nSWIGPY_SWIGFLAGS ``[-python', '-builtin']``\nSWIGPY_SWIGDIRECTORSUFFIX\nSWIGPY_SWIGCFILESUFFIX\nSWIGPY_SWIGCXXFILESUFFIX\nSWIGPY_SWIGPATH\nSWIGPY_SWIGINCPREFIX\nSWIGPY_SWIGINCSUFFIX\nSWIGPY_SWIGCOM\nSWIGPY_CPPPATH ``[\"$SWIGPY_PYTHONINCDIR\"]``\nSWIGPY_SHOBJPREFIX\nSWIGPY_SHOBJSUFFIX\nSWIGPY_SHLIBPREFIX ``'_'``\nSWIGPY_SHLIBSUFFIX ``.pyd`` on Windows\nSWIGPY_LIBPREFIX ``'_'``\nSWIGPY_LIBSUFFIX\nSWIGPY_IMPLIBPREFIX ``'_'``\nSWIGPY_IMPLIBSUFFIX\nSWIGPY_WINDOWSEXPPREFIX ``'_'``\nSWIGPY_WINDOWSEXPSUFFIX\nSWIGPY_CC\nSWIGPY_CXX\nSWIGPY_SHCC\nSWIGPY_SHCXX\nSWIGPY_CCFLAGS\nSWIGPY_CFLAGS\nSWIGPY_CXXFLAGS\nSWIGPY_SHCCFLAGS\nSWIGPY_SHCFLAGS\nSWIGPY_SHCXXFLAGS\nSWIGPY_LIBS ``[\"$SWIGPY_PYTHONLIB\"]``\nSWIGPY_LIBPATH ``[\"$SWIGPY_PYTHONLIBDIR\"]``\nSWIGPY_LINKFLAGS\nSWIGPY_M2SWIGFILE ``lambda parts: path.join(*parts) + '.i'``\nSWIGPY_M2CFILE ``lambda parts: path.join(*parts)``\nSWIGPY_M2SHLIBFILE ``lambda parts: path.join(*parts)``\n========================= =============================================\n\nThe **SWIGPY_M2SWIGFILE** lambda determines the name of swig interface (source\nfile). The **SWIGPY_M2CFILE** determines the name (without suffix) of the **C**\nor **C++** wrapper file being generated by **swig**. The **SWIGPY_M2SHLIBFILE**\ndetermines the name of shared library that will contain the wrapper binary code\nafter compilation (without prefix and suffix). The **parts** provided to any of\nthese macros are the parts of **modname**, that is they're result of\n``modname.split('.')``.\n\nLICENSE\n-------\n\nCopyright (c) 2014-2018 by Pawel Tomulik \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE\n\n.. _SCons: http://scons.org\n.. _Swig: http://swig.org\n.. _pipenv: https://pipenv.readthedocs.io/\n.. _pypi: https://pypi.org/\n.. _scons-tool-swigpy: https://github.com/ptomulik/scons-tool-swigpy\n.. _scons-tool-loader: https://github.com/ptomulik/scons-tool-loader\n\n.. \n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ptomulik/scons-tool-swigpy", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "scons-tool-swigpy", "package_url": "https://pypi.org/project/scons-tool-swigpy/", "platform": "", "project_url": "https://pypi.org/project/scons-tool-swigpy/", "project_urls": { "Homepage": "https://github.com/ptomulik/scons-tool-swigpy" }, "release_url": "https://pypi.org/project/scons-tool-swigpy/0.1.1/", "requires_dist": [ "scons-tool-util (>=0.1.9)" ], "requires_python": ">=2.7", "summary": "SCons tool to generate Python modules using SWIG", "version": "0.1.1" }, "last_serial": 5176894, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "eba603fccee55d3b00f9ae75846c02f0", "sha256": "cd034c373fa3e142c70411ec5a522d4a5cc1d8e8cce4855f010664eb444c9445" }, "downloads": -1, "filename": "scons_tool_swigpy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "eba603fccee55d3b00f9ae75846c02f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 9358, "upload_time": "2018-11-15T07:46:54", "url": "https://files.pythonhosted.org/packages/b7/16/59b27681492b28cf66c69020aced0b87be3302493b1d46a67b18343985c6/scons_tool_swigpy-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cbecc0b86005a7ae48d3534602a43992", "sha256": "4ea793e492475942feb24ed18241e9f299b5db58bd126151217ed09c857568a5" }, "downloads": -1, "filename": "scons-tool-swigpy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cbecc0b86005a7ae48d3534602a43992", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 7965, "upload_time": "2018-11-15T07:46:56", "url": "https://files.pythonhosted.org/packages/c6/29/3b90963a9393d487fb99517aed6a131dac2d6ae34ef42c8709ecf4102fce/scons-tool-swigpy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "297fd70ac6bd4cbf13d8a845d398fe00", "sha256": "321f3488c6758f7bef8afc9cea2db98e588f63a375f9eccf9f6d0839ff745d56" }, "downloads": -1, "filename": "scons_tool_swigpy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "297fd70ac6bd4cbf13d8a845d398fe00", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 9355, "upload_time": "2019-04-23T11:59:45", "url": "https://files.pythonhosted.org/packages/5a/79/1136e7df372b6d57ea4c4bedc0719c3e412b69adc6e7db511d323c918e83/scons_tool_swigpy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9aa7cbdb075dd48fa084c888ac1df1e3", "sha256": "f32c7feaac3a66f8ac4adb5e860e68b303ef5a707839f5e3461137e5ccaefca3" }, "downloads": -1, "filename": "scons-tool-swigpy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9aa7cbdb075dd48fa084c888ac1df1e3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 8813, "upload_time": "2019-04-23T11:59:46", "url": "https://files.pythonhosted.org/packages/54/fc/af510f07392278125889d5ba71e35876cee87b2d5a83a63c9f14733c73ca/scons-tool-swigpy-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "297fd70ac6bd4cbf13d8a845d398fe00", "sha256": "321f3488c6758f7bef8afc9cea2db98e588f63a375f9eccf9f6d0839ff745d56" }, "downloads": -1, "filename": "scons_tool_swigpy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "297fd70ac6bd4cbf13d8a845d398fe00", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7", "size": 9355, "upload_time": "2019-04-23T11:59:45", "url": "https://files.pythonhosted.org/packages/5a/79/1136e7df372b6d57ea4c4bedc0719c3e412b69adc6e7db511d323c918e83/scons_tool_swigpy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9aa7cbdb075dd48fa084c888ac1df1e3", "sha256": "f32c7feaac3a66f8ac4adb5e860e68b303ef5a707839f5e3461137e5ccaefca3" }, "downloads": -1, "filename": "scons-tool-swigpy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "9aa7cbdb075dd48fa084c888ac1df1e3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 8813, "upload_time": "2019-04-23T11:59:46", "url": "https://files.pythonhosted.org/packages/54/fc/af510f07392278125889d5ba71e35876cee87b2d5a83a63c9f14733c73ca/scons-tool-swigpy-0.1.1.tar.gz" } ] }