Menu

[ccc612]: / binding / python / jamfile.jam  Maximize  Restore  History

Download this file

231 lines (206 with data), 6.1 kB

## owlcpp/binding/python/jamfile.jam
## part of owlcpp project.
## Distributed under the Boost Software License, Version 1.0; see doc/license.txt.
## Copyright Mikhail K Levin 2011-5

project owlcpp/binding/python
    : build-dir $(PYTHON_OUT)
    : requirements 
#      <library>/boost/python//boost_python 
#      <library>/owlcpp//rdf
;

import python modules path common regex ;

author = "Mikhail K. Levin" ;
email = "mlevin@svarnetics.org" ;
proj_url = "http://owl-cpp.sf.net/" ;
version = [ process_version_string $(OWLCPP_VERSION) ] ;
lib_stage = $(PYTHON_OUT)/owlcpp ;
doc_src_stage = $(PYTHON_OUT)/doc/_sources ;
doc_dest = $(PYTHON_OUT)/doc ;

## 
################################################################################
python-extension _rdf 
   : 
      [ glob rdf*.cpp ]
      /boost/python//boost_python
      /owlcpp//rdf
   :
      $(LIB_REQUIREMENTS)
      #enable runtime linking from same directory
      <toolset>gcc,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <toolset>clang,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <hardcode-dll-paths>true
;

## 
################################################################################
python-extension terms
   : 
      terms.cpp
      /boost/python//boost_python
   :
      <include>$(PROJ_ROOT)/lib
      $(LIB_REQUIREMENTS)
      #enable runtime linking from same directory
      <toolset>gcc,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <toolset>clang,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <hardcode-dll-paths>true
;

## 
################################################################################
python-extension _io 
   : 
      [ glob io*.cpp ] 
      /boost/python//boost_python
      /owlcpp//rdf
      /owlcpp//io
   :
      $(LIB_REQUIREMENTS)
      #enable runtime linking from same directory
      <toolset>gcc,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <toolset>clang,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <hardcode-dll-paths>true
;

## 
################################################################################
python-extension _logic
   : 
      [ glob logic*.cpp ] 
      [ glob factpp*.cpp ]
      /boost/python//boost_python
      /owlcpp//rdf
      /owlcpp//logic
   :
      $(LIB_REQUIREMENTS)
      #enable runtime linking from same directory
      <toolset>gcc,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <toolset>clang,<target-os>linux:<linkflags>"-Wl,-R'$ORIGIN/'"
      <hardcode-dll-paths>true
;

## 
################################################################################
make __init__.py : : @init_py : <location>$(lib_stage) ;
actions init_py {
    @($(STDOUT):E=#!/usr/bin/env python
'''
.. automodule:: owlcpp._rdf
   :members:

.. automodule:: owlcpp.terms
   :members:

.. automodule:: owlcpp._io
   :members:

.. automodule:: owlcpp._logic
   :members:

'''

from _rdf import *
from _io import *
from _logic import *
import terms
__version__ = '$(version[1]).$(version[2]).$(version[3])'
) > "$(<)"
}

## 
################################################################################
install _py_lib
   : 
      _rdf terms _io _logic
   : 
      <location>$(lib_stage)
      <install-dependencies>on
      <install-type>LIB
      <dependency>__init__.py
;

## 
################################################################################
alias stage_py 
   : # sources
      _py_lib
   : # requirements
   : # default-build
   : # usage-requirements
      <pythonpath>$(PYTHON_OUT)
;

## 
################################################################################
install _py_test
   :
      [ glob test/*.py ]
      [ glob $(PROJ_ROOT)/python/test/*.py ]
   :
      <location>$(PYTHON_OUT)/test
;

## 
################################################################################
install _py_docs
   :
      $(PROJ_ROOT)/doc/license.txt
   :
      <location>$(doc_src_stage)
;

## 
################################################################################
install _manifest
   :
      $(PROJ_ROOT)/build/MANIFEST.in
      $(PROJ_ROOT)/readme.txt
   :
      <location>$(PYTHON_OUT)
;

## 
################################################################################
make setup.py 
   : stage_py 
   : @setup_py 
   : <location>$(PYTHON_OUT) 
;
rule setup_py ( targets * : sources * : properties * ) {
    data_files = 
      "       'owlcpp/"$(sources:G=)"'," 
    ;
    
    local platform = [ modules.peek : OS ] ;
    
    local src = 
        "#!/usr/bin/env python"
        ""
        "from distutils.core import setup"
        "from distutils.command.install_data import install_data"
        ""
        "class smart_install_data(install_data):"
        "    def run(self):"
        "        install_cmd = self.get_finalized_command('install')"
        "        self.install_dir = getattr(install_cmd, 'install_lib')"
        "        return install_data.run(self)"
        "" 
        "setup("
        "    name = 'owlcpp',"
        "    version            = '$(version[1]).$(version[2]).$(version[3])',"
        "    description        = '$(OWLCPP_DESCRIPTION)',"
        "    long_description   = '$(OWLCPP_DESCRIPTION)',"
        "    license            = '$(OWLCPP_LICENSE)',"
        "    author             = [ '$(author)' ],"
        "    author_email       = '$(email)',"
        "    url                = '$(proj_url)',"
        "    packages           = ['owlcpp'],"
        "    cmdclass           = {'install_data' : smart_install_data},"
        "    platforms          = ['$(platform)'],"
        "    data_files         = [('owlcpp', [" $(data_files) "    ] )]"
        ")"
        ""
    ;
    src = $(src:J="
") ;

    STR on $(<) = $(src) ;
}
actions setup_py { @($(STDOUT):E=$(STR)) > "$(<)" }

## 
################################################################################
make distro-bindings 
   : setup.py 
   : @release-py 
   : 
      <dependency>stage_py 
      <dependency>_py_test
      <dependency>_py_docs
      <dependency>_manifest 
;
actions release-py {
    cd $(PYTHON_OUT)
    python $(>) sdist -d $(OUT)
}

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.