Mercurial > pymonkey
changeset 102:e455f0f00e98
Moved mange.py to setup.py for convention's sake and updated docs on the build process.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sat, 15 Aug 2009 16:53:32 -0700 |
parents | ca94f99ad55d |
children | 257de12e58c4 |
files | README docs/rendered/_sources/index.txt docs/rendered/index.html docs/rendered/searchindex.js docs/src/index.txt manage.py setup.py |
diffstat | 7 files changed, 149 insertions(+), 135 deletions(-) [+] |
line wrap: on
line diff
--- a/README Sat Aug 15 16:41:48 2009 -0700 +++ b/README Sat Aug 15 16:53:32 2009 -0700 @@ -4,5 +4,5 @@ Pymonkey is a Python C extension module to expose the Mozilla SpiderMonkey engine to Python. -Please run "python manage.py docs" to open the full Pymonkey +Please run "python setup.py docs" to open the full Pymonkey documentation in your web browser.
--- a/docs/rendered/_sources/index.txt Sat Aug 15 16:41:48 2009 -0700 +++ b/docs/rendered/_sources/index.txt Sat Aug 15 16:53:32 2009 -0700 @@ -75,17 +75,22 @@ http://hg.toolness.com/spidermonkey/ -Just HG clone that repository and read the instructions in the README -to build SpiderMonkey. +Just HG clone that repository in the root of your pymonkey repository +and read the instructions in the ``README`` file to build SpiderMonkey. Then come back to the root of your pymonkey repository and run:: - python manage.py build --static --objdir=PATH_TO_OBJDIR + python setup.py build + +Then run:: + + sudo python setup.py install -Where ``PATH_TO_OBJDIR`` is the path to your Mozilla/SpiderMonkey build's -objdir. +Note that if you're on Windows, you won't need the ``sudo`` bit. -Note that at the moment, the build script is only tested on OS X. +You can run the test suite by entering:: + + python setup.py test Challenges ==========
--- a/docs/rendered/index.html Sat Aug 15 16:41:48 2009 -0700 +++ b/docs/rendered/index.html Sat Aug 15 16:53:32 2009 -0700 @@ -108,14 +108,18 @@ latter can be obtained here:</p> <blockquote> <a class="reference" href="http://hg.toolness.com/spidermonkey/">http://hg.toolness.com/spidermonkey/</a></blockquote> -<p>Just HG clone that repository and read the instructions in the README -to build SpiderMonkey.</p> +<p>Just HG clone that repository in the root of your pymonkey repository +and read the instructions in the <tt class="docutils literal"><span class="pre">README</span></tt> file to build SpiderMonkey.</p> <p>Then come back to the root of your pymonkey repository and run:</p> -<div class="highlight-python"><pre>python manage.py build --static --objdir=PATH_TO_OBJDIR</pre> +<div class="highlight-python"><pre>python setup.py build</pre> +</div> +<p>Then run:</p> +<div class="highlight-python"><pre>sudo python setup.py install</pre> </div> -<p>Where <tt class="docutils literal"><span class="pre">PATH_TO_OBJDIR</span></tt> is the path to your Mozilla/SpiderMonkey build’s -objdir.</p> -<p>Note that at the moment, the build script is only tested on OS X.</p> +<p>Note that if you’re on Windows, you won’t need the <tt class="docutils literal"><span class="pre">sudo</span></tt> bit.</p> +<p>You can run the test suite by entering:</p> +<div class="highlight-python"><pre>python setup.py test</pre> +</div> </div> <div class="section" id="challenges"> <h2>Challenges<a class="headerlink" href="#challenges" title="Permalink to this headline">ΒΆ</a></h2>
--- a/docs/rendered/searchindex.js Sat Aug 15 16:41:48 2009 -0700 +++ b/docs/rendered/searchindex.js Sat Aug 15 16:53:32 2009 -0700 @@ -1,1 +1,1 @@ -Search.setIndex({desctypes:{"0":"method","1":"exception","2":"class","3":"data"},terms:{spidermonkei:[0,1],represent:1,all:0,code:[0,1],untrust:0,lack:0,concept:0,get_object_priv:1,privat:1,depend:0,readabl:0,program:1,isinst:1,liter:1,string:1,veri:[0,1],vast:0,level:1,"try":0,second:1,pass:1,casual:0,even:[],index:0,evaluate_script:1,abl:0,access:[0,1],"new":1,objdir:0,method:1,metadata:1,full:0,never:0,onli:[0,1],here:0,objcec:[],path:0,valu:1,search:0,doctest:0,chang:1,tremend:0,via:[0,1],modul:[0,1],filenam:1,api:0,test_pymonkei:[],from:[0,1],would:0,memori:0,init_standard_class:1,call:1,scope:1,type:1,more:[0,1],thisobj:1,mozilla:[0,1],ctype:0,known:0,central:0,must:0,none:1,retriev:1,work:0,conceptu:1,can:[0,1],learn:0,akin:0,root:0,give:0,process:0,challeng:0,indic:0,want:[0,1],unfortun:[],alwai:0,goal:0,secur:[0,1],write:0,how:0,verifi:1,map:1,product:0,clone:0,usabl:0,befor:0,mai:1,associ:1,third:[0,1],counter:1,inform:1,sandbox:0,environ:0,subtyp:1,callabl:1,becaus:0,intermediari:0,through:1,dynam:0,platform:0,easier:0,them:0,js_initstandardclass:1,"return":1,thei:[],python:[0,1],now:[],xpcom:0,name:1,anyth:0,get_runtim:1,easili:0,trap:0,each:1,debug:[0,1],side:0,mean:0,realli:0,wrap:1,"static":0,collector:0,out:0,path_to_objdir:0,profil:0,lineno:1,rational:0,print:1,forth:1,situat:0,free:[],standard:[0,1],reason:[],base:0,thrown:1,thread:1,traceback:0,first:1,singleton:1,obviou:0,pyrex:0,feel:[],arrai:1,number:[0,1],instruct:0,facil:0,given:1,script:0,interact:1,too:0,"final":0,store:1,relationship:0,tool:0,huh:[],than:0,wide:0,kind:[],provid:0,posit:1,browser:0,pre:1,falsi:1,ani:[0,1],packag:0,have:[0,1],tabl:0,need:0,"null":1,engin:[0,1],built:1,equival:1,latter:0,client:0,note:0,also:[0,1],ideal:0,exampl:[],build:0,which:[0,1],noth:[0,1],trace:1,object:[0,1],plai:0,"class":1,don:0,clear:1,later:1,doe:[],runtim:1,awesom:0,text:1,particularli:0,line:1,involv:0,current:[0,1],new_object:1,execut:[0,1],solut:0,should:0,busi:0,contribut:0,pave:0,increas:0,requir:0,enabl:0,contain:1,where:0,new_context:1,see:1,arg:1,disadvantag:0,best:1,detect:0,someth:0,state:1,outstand:0,between:0,atul:0,call_funct:1,javascript:[0,1],extens:0,preprocessor:0,complementari:0,come:[0,1],expos:0,cycl:0,howev:0,blargh:[],instanc:[0,1],context:[0,1],logic:0,freeli:1,com:0,private_obj:1,simpli:[],within:1,sweep:0,header:0,assum:1,duplic:0,quit:0,java:0,evalu:1,due:0,mark:0,clear_object_priv:[0,1],argument:1,func:1,straight:0,durat:1,defin:[0,1],error:1,advantag:0,unintuit:[],readm:0,blah:[],develop:0,parti:0,make:0,belong:1,cross:0,same:1,complex:0,document:[0,1],http:0,wherea:0,effect:1,hand:0,fairli:0,moment:0,rais:1,stack:[0,1],pymonkei:[0,1],off:0,macro:0,without:0,thi:[0,1],undefin:1,programm:0,model:0,capi:0,new_funct:1,just:0,less:0,obtain:0,languag:0,web:0,easi:0,except:1,add:[],other:[0,1],around:0,read:0,swig:0,envis:0,know:[],world:0,like:[0,1],vibrant:0,manual:0,resolv:0,server:0,collect:0,either:0,docutil:1,page:0,right:[],some:0,back:0,global:1,mirror:0,librari:0,rhino:0,refer:0,run:0,garbag:0,broken:0,repositori:0,about:0,actual:0,manag:0,runtm:1,three:1,serverj:0,contributor:0,your:0,span:1,wai:0,ergonom:0,custom:0,avail:0,interfac:1,low:1,lot:0,suit:[],"function":[0,1],offer:1,tupl:1,globalobj:1,eas:0,"true":1,count:0,made:0,possibl:0,similar:0,featur:0,creat:[0,1],doesn:[0,1],repres:1,exist:[0,1],file:[0,1],check:[],probabl:0,boop:[],todo:[],when:1,field:0,valid:0,test:0,you:[0,1],boof:[],matur:0,relat:1,eval:1,unbind:1,land:[0,1],sphinx:0,directori:0,obj:1,time:0},titles:["Pymonkey Documentation","<tt class=\"docutils literal docutils literal\"><span class=\"pre\">pymonkey</span></tt> — Access SpiderMonkey from Python"],modules:{pymonkey:1},descrefs:{"pymonkey.Runtime":{new_context:[1,0]},"pymonkey.Object":{get_runtime:[1,0]},"pymonkey.Context":{get_object_private:[1,0],new_object:[1,0],call_function:[1,0],evaluate_script:[1,0],clear_object_private:[1,0],new_function:[1,0],init_standard_classes:[1,0],get_runtime:[1,0]},pymonkey:{Function:[1,2],undefined:[1,3],Object:[1,2],Context:[1,2],error:[1,1],Runtime:[1,2]}},filenames:["index","pymonkey"]}) \ No newline at end of file +Search.setIndex({desctypes:{"0":"method","1":"exception","2":"class","3":"data"},terms:{spidermonkei:[0,1],represent:1,all:0,code:[0,1],untrust:0,lack:0,concept:0,get_object_priv:1,privat:1,depend:0,readabl:0,program:1,isinst:1,liter:1,string:1,veri:[0,1],vast:0,level:1,"try":0,second:1,pass:1,casual:0,even:[],index:0,evaluate_script:1,abl:0,access:[0,1],"new":1,objdir:[],method:1,metadata:1,full:0,subtyp:1,never:0,onli:[0,1],here:0,objcec:[],path:[],valu:1,search:0,doctest:0,chang:1,tremend:0,via:[0,1],modul:[0,1],filenam:1,api:0,instal:0,test_pymonkei:[],from:[0,1],would:0,memori:0,init_standard_class:1,call:1,scope:1,type:1,more:[0,1],thisobj:1,mozilla:[0,1],ctype:0,known:0,central:0,must:0,none:1,retriev:1,setup:0,work:0,conceptu:1,can:[0,1],learn:0,akin:0,root:0,give:0,process:0,challeng:0,sudo:0,indic:0,want:[0,1],unfortun:[],alwai:0,goal:0,secur:[0,1],write:0,how:0,verifi:1,map:1,product:0,clone:0,usabl:0,befor:0,mai:1,associ:1,third:[0,1],counter:1,inform:1,sandbox:0,environ:0,enter:0,callabl:1,becaus:0,intermediari:0,through:1,dynam:0,platform:0,window:0,easier:0,them:0,js_initstandardclass:1,"return":1,thei:[],python:[0,1],now:[],xpcom:0,name:1,anyth:0,get_runtim:1,easili:0,trap:0,each:1,debug:[0,1],side:0,mean:0,realli:0,wrap:1,"static":[],collector:0,out:0,path_to_objdir:[],profil:0,lineno:1,rational:0,print:1,forth:1,situat:0,free:[],standard:[0,1],reason:[],base:0,thrown:1,thread:1,traceback:0,first:1,singleton:1,obviou:0,pyrex:0,feel:[],arrai:1,number:[0,1],instruct:0,facil:0,given:1,script:[],interact:1,too:0,"final":0,store:1,relationship:0,tool:0,huh:[],than:0,wide:0,kind:[],provid:0,posit:1,browser:0,pre:1,falsi:1,ani:[0,1],packag:0,have:[0,1],tabl:0,need:0,"null":1,engin:[0,1],built:1,equival:1,latter:0,client:0,note:0,also:[0,1],ideal:0,exampl:[],build:0,which:[0,1],noth:[0,1],trace:1,object:[0,1],plai:0,"class":1,don:0,clear:1,later:1,doe:[],runtim:1,awesom:0,text:1,particularli:0,line:1,involv:0,current:[0,1],new_object:1,execut:[0,1],solut:0,should:0,busi:0,contribut:0,pave:0,increas:0,requir:0,enabl:0,contain:1,where:0,new_context:1,see:1,arg:1,disadvantag:0,best:1,detect:0,someth:0,state:1,won:0,outstand:0,between:0,atul:0,call_funct:1,javascript:[0,1],extens:0,preprocessor:0,complementari:0,come:[0,1],expos:0,cycl:0,howev:0,blargh:[],instanc:[0,1],context:[0,1],logic:0,freeli:1,com:0,private_obj:1,simpli:[],within:1,sweep:0,header:0,assum:1,duplic:0,quit:0,java:0,evalu:1,due:0,mark:0,clear_object_priv:[0,1],argument:1,func:1,straight:0,durat:1,defin:[0,1],error:1,advantag:0,unintuit:[],readm:0,blah:[],develop:0,parti:0,make:0,belong:1,cross:0,same:1,complex:0,document:[0,1],http:0,wherea:0,effect:1,hand:0,fairli:0,moment:[],rais:1,stack:[0,1],pymonkei:[0,1],off:0,macro:0,without:0,thi:[0,1],undefin:1,programm:0,model:0,capi:0,new_funct:1,just:0,less:0,obtain:0,languag:0,web:0,easi:0,except:1,add:[],other:[0,1],around:0,read:0,swig:0,envis:0,know:[],world:0,bit:0,like:[0,1],vibrant:0,manual:0,resolv:0,server:0,collect:0,either:0,docutil:1,page:0,right:[],some:0,back:0,global:1,mirror:0,librari:0,rhino:0,refer:0,run:0,garbag:0,broken:0,repositori:0,about:0,actual:0,manag:[],runtm:1,three:1,serverj:0,contributor:0,your:0,span:1,wai:0,ergonom:0,custom:0,avail:0,interfac:1,low:1,lot:0,suit:0,"function":[0,1],offer:1,tupl:1,globalobj:1,eas:0,"true":1,count:0,made:0,possibl:0,similar:0,featur:0,creat:[0,1],doesn:[0,1],repres:1,exist:[0,1],file:[0,1],check:[],probabl:0,boop:[],todo:[],when:1,field:0,valid:0,test:0,you:[0,1],boof:[],matur:0,relat:1,eval:1,unbind:1,land:[0,1],sphinx:0,directori:0,obj:1,time:0},titles:["Pymonkey Documentation","<tt class=\"docutils literal docutils literal\"><span class=\"pre\">pymonkey</span></tt> — Access SpiderMonkey from Python"],modules:{pymonkey:1},descrefs:{"pymonkey.Runtime":{new_context:[1,0]},"pymonkey.Object":{get_runtime:[1,0]},"pymonkey.Context":{get_object_private:[1,0],new_object:[1,0],call_function:[1,0],evaluate_script:[1,0],clear_object_private:[1,0],new_function:[1,0],init_standard_classes:[1,0],get_runtime:[1,0]},pymonkey:{Function:[1,2],undefined:[1,3],Object:[1,2],Context:[1,2],error:[1,1],Runtime:[1,2]}},filenames:["index","pymonkey"]}) \ No newline at end of file
--- a/docs/src/index.txt Sat Aug 15 16:41:48 2009 -0700 +++ b/docs/src/index.txt Sat Aug 15 16:53:32 2009 -0700 @@ -75,17 +75,22 @@ http://hg.toolness.com/spidermonkey/ -Just HG clone that repository and read the instructions in the README -to build SpiderMonkey. +Just HG clone that repository in the root of your pymonkey repository +and read the instructions in the ``README`` file to build SpiderMonkey. Then come back to the root of your pymonkey repository and run:: - python manage.py build --static --objdir=PATH_TO_OBJDIR + python setup.py build + +Then run:: + + sudo python setup.py install -Where ``PATH_TO_OBJDIR`` is the path to your Mozilla/SpiderMonkey build's -objdir. +Note that if you're on Windows, you won't need the ``sudo`` bit. -Note that at the moment, the build script is only tested on OS X. +You can run the test suite by entering:: + + python setup.py test Challenges ==========
--- a/manage.py Sat Aug 15 16:41:48 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -#! /usr/bin/env python - -import os -import sys - -if __name__ == '__main__': - # This code is run if we're executed directly from the command-line. - - myfile = os.path.abspath(__file__) - mydir = os.path.dirname(myfile) - sys.path.insert(0, os.path.join(mydir, 'python-modules')) - - args = sys.argv[1:] - if not args: - args = ['help'] - - # Have paver run this very file as its pavement script. - args = ['-f', myfile] + args - - import paver.tasks - paver.tasks.main(args) - sys.exit(0) - -# This code is run if we're executed as a pavement script by paver. - -import os -import subprocess -import shutil -import sys -import webbrowser -import urllib - -from paver.easy import * -from paver.setuputils import setup -from distutils.core import Extension - -SOURCE_FILES = ['pymonkey.cpp', - 'utils.cpp', - 'object.cpp', - 'function.cpp', - 'undefined.cpp', - 'context.cpp', - 'runtime.cpp'] - -SPIDERMONKEY_DIR = os.path.abspath(os.path.join('spidermonkey', 'obj')) - -if not os.path.exists(SPIDERMONKEY_DIR): - print('WARNING: Spidermonkey objdir not found at %s.' % SPIDERMONKEY_DIR) - print('Some build tasks may not run properly.\n') - -INCLUDE_DIRS = [os.path.join(SPIDERMONKEY_DIR, 'dist', 'include')] -LIB_DIRS = [os.path.join(SPIDERMONKEY_DIR)] - -setup(name='pymonkey', - version='0.0.1', - description='Access SpiderMonkey from Python', - author='Atul Varma', - author_email='atul@mozilla.com', - url='http://www.toolness.com', - ext_modules=[Extension('pymonkey', - SOURCE_FILES, - include_dirs = INCLUDE_DIRS, - library_dirs = LIB_DIRS, - libraries = ['js_static'])] - ) - -@task -def docs(options): - """Open the Pymonkey documentation in your web browser.""" - - url = os.path.abspath(os.path.join("docs", "rendered", "index.html")) - url = urllib.pathname2url(url) - webbrowser.open(url) - -@task -def build_docs(options): - """Build the Pymonkey documentation (requires Sphinx).""" - - retval = subprocess.call(["sphinx-build", - "-b", "html", - os.path.join("docs", "src"), - os.path.join("docs", "rendered")]) - if retval: - sys.exit(retval) - -@task -def test(options): - """Test the Pymonkey Python C extension.""" - - print "Running test suite." - - new_env = {} - new_env.update(os.environ) - - result = subprocess.call( - [sys.executable, - "test_pymonkey.py"], - env = new_env - ) - - if result: - sys.exit(result) - - print "Running doctests." - - # We have to add our current directory to the python path so that - # our doctests can find the pymonkey module. - new_env['PYTHONPATH'] = os.path.abspath('.') - retval = subprocess.call(["sphinx-build", - "-b", "doctest", - os.path.join("docs", "src"), - "_doctest_output"], - env = new_env) - if retval: - sys.exit(retval)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Sat Aug 15 16:53:32 2009 -0700 @@ -0,0 +1,115 @@ +#! /usr/bin/env python + +import os +import sys + +if __name__ == '__main__': + # This code is run if we're executed directly from the command-line. + + myfile = os.path.abspath(__file__) + mydir = os.path.dirname(myfile) + sys.path.insert(0, os.path.join(mydir, 'python-modules')) + + args = sys.argv[1:] + if not args: + args = ['help'] + + # Have paver run this very file as its pavement script. + args = ['-f', myfile] + args + + import paver.tasks + paver.tasks.main(args) + sys.exit(0) + +# This code is run if we're executed as a pavement script by paver. + +import os +import subprocess +import shutil +import sys +import webbrowser +import urllib + +from paver.easy import * +from paver.setuputils import setup +from distutils.core import Extension + +SOURCE_FILES = ['pymonkey.cpp', + 'utils.cpp', + 'object.cpp', + 'function.cpp', + 'undefined.cpp', + 'context.cpp', + 'runtime.cpp'] + +SPIDERMONKEY_DIR = os.path.abspath(os.path.join('spidermonkey', 'obj')) + +if not os.path.exists(SPIDERMONKEY_DIR): + print('WARNING: Spidermonkey objdir not found at %s.' % SPIDERMONKEY_DIR) + print('Some build tasks may not run properly.\n') + +INCLUDE_DIRS = [os.path.join(SPIDERMONKEY_DIR, 'dist', 'include')] +LIB_DIRS = [os.path.join(SPIDERMONKEY_DIR)] + +setup(name='pymonkey', + version='0.0.1', + description='Access SpiderMonkey from Python', + author='Atul Varma', + author_email='atul@mozilla.com', + url='http://www.toolness.com', + ext_modules=[Extension('pymonkey', + SOURCE_FILES, + include_dirs = INCLUDE_DIRS, + library_dirs = LIB_DIRS, + libraries = ['js_static'])] + ) + +@task +def docs(options): + """Open the Pymonkey documentation in your web browser.""" + + url = os.path.abspath(os.path.join("docs", "rendered", "index.html")) + url = urllib.pathname2url(url) + webbrowser.open(url) + +@task +def build_docs(options): + """Build the Pymonkey documentation (requires Sphinx).""" + + retval = subprocess.call(["sphinx-build", + "-b", "html", + os.path.join("docs", "src"), + os.path.join("docs", "rendered")]) + if retval: + sys.exit(retval) + +@task +def test(options): + """Test the Pymonkey Python C extension.""" + + print "Running test suite." + + new_env = {} + new_env.update(os.environ) + + result = subprocess.call( + [sys.executable, + "test_pymonkey.py"], + env = new_env + ) + + if result: + sys.exit(result) + + print "Running doctests." + + # We have to add our current directory to the python path so that + # our doctests can find the pymonkey module. + new_env['PYTHONPATH'] = os.path.abspath('.') + retval = subprocess.call(["sphinx-build", + "-b", "doctest", + os.path.join("docs", "src"), + "_doctest_output"], + env = new_env) + if retval: + sys.exit(retval)