change salt to be binary! This change makes cython modules buildable

with the setup.py, time to start moving core salt modules to cython!
This commit is contained in:
Thomas S Hatch 2011-08-02 23:02:00 -06:00
parent b5b778f791
commit 3a6f011107
2 changed files with 34 additions and 2 deletions

25
salt/modules/grains.pyx Normal file
View file

@ -0,0 +1,25 @@
'''
Control aspects of the grains data
'''
# Seed the grains dict so cython will build
__grains__ = {}
def items():
'''
Return the grains data
CLI Example:
salt '*' grains.items
'''
return __grains__
def item(key):
'''
Return a singe component of the grains data
CLI Example:
salt '*' grains.item os
'''
if __grains__.has_key(key):
return __grains__[key]
return ''

View file

@ -10,6 +10,7 @@ from distutils.cmd import Command
from distutils.core import setup
from distutils.extension import Extension
from distutils.sysconfig import get_python_lib, PREFIX
from Cython.Distutils import build_ext
NAME = 'salt'
VER = '0.8.9'
@ -68,9 +69,15 @@ class UnitTest(Command):
if sys.path[0] == dirname:
del sys.path[0]
setup(name=NAME,
setup(
name=NAME,
version=VER,
cmdclass={"test":UnitTest},
ext_modules=[Extension('salt.modules.grains', ['salt/modules/grains.pyx'])],
cmdclass={
'test':UnitTest,
'build_ext': build_ext,
},
description=DESC,
author='Thomas S Hatch',
author_email='thatch45@gmail.com',