Glpk needs to be built using configure make install commands. So I have used zc.recipe.cmmi recipe for building glpk package. It generates glpsol command in the bin directory. I need to be able to use this command 'glpsol' in my python code which runs via an entry point specified in setup.py. When I directly call os.system('glpsol')
, it says commmand not found. Is there any way of adding an entry into the PATH env variable so that the bin directory is added to the PATH env variable. I'm new to buildout and might be doing this wrong. In case there is a better way to doing it, please suggest. Find the files I'm using below.
useglpk.py
import os
def useglpk():
print os.environ['PATH']
print os.system('glpsol')
setup.py
from setuptools import setup, find_packages
setup(
name="sample",
entry_points = {
'console_scripts': [
'useglpk = useglpk:useglpk'
]
}
)
buildout.cfg
[buildout]
parts =
glpk
sample
develop = .
[sample]
recipe = zc.recipe.egg:scripts
eggs = sample
interpreter = samplepy
[glpk]
recipe = zc.recipe.cmmi
url = http://ftp.gnu.org/gnu/glpk/glpk-4.52.tar.gz
configure-options = --prefix=${buildout:directory}
You can add initialisation code to the script generated with the
initialization
entry:Here we interpolated the buildout
bin/
directory to be prepended to thePATH
environment variable.