# HG changeset patch
# User Atul Varma
# Date 1250452426 25200
# Node ID 1e6523de9df1e5e449fc84cd9dc2db159ee1eab5
# Parent 9d4cd0803df5c718a457a06affee906e954e672c
Fixed docs to represent the much-simplified build process, fixed the test target to work w/ default build options, moved doctest output dir into build dir.
diff -r 9d4cd0803df5 -r 1e6523de9df1 .hgignore
--- a/.hgignore Sun Aug 16 11:44:49 2009 -0700
+++ b/.hgignore Sun Aug 16 12:53:46 2009 -0700
@@ -6,4 +6,3 @@
docs/rendered/objects.inv
spidermonkey-1.8.1pre
build
-_doctest_output
diff -r 9d4cd0803df5 -r 1e6523de9df1 docs/rendered/_sources/index.txt
--- a/docs/rendered/_sources/index.txt Sun Aug 16 11:44:49 2009 -0700
+++ b/docs/rendered/_sources/index.txt Sun Aug 16 12:53:46 2009 -0700
@@ -66,21 +66,15 @@
* Finally, Atul has never really made a straight Python CAPI module
before, so he wanted to give it a try.
-Building and Testing
-====================
+Building, Testing, and Installing
+=================================
-You can either build SpiderMonkey off the mozilla-central HG
-repository, or off a mirror I made of its SpiderMonkey directory. The
-latter can be obtained here:
+From the root of your pymonkey repository, run::
- http://hg.toolness.com/spidermonkey/
+ python setup.py build test
-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 setup.py build
+This will build the C extension and run its test suite to ensure that
+everything works properly.
Then run::
@@ -88,10 +82,6 @@
Note that if you're on Windows, you won't need the ``sudo`` bit.
-You can run the test suite by entering::
-
- python setup.py test
-
Challenges
==========
diff -r 9d4cd0803df5 -r 1e6523de9df1 docs/rendered/index.html
--- a/docs/rendered/index.html Sun Aug 16 11:44:49 2009 -0700
+++ b/docs/rendered/index.html Sun Aug 16 12:53:46 2009 -0700
@@ -101,25 +101,17 @@
before, so he wanted to give it a try.
-
-
Building and Testing
-
You can either build SpiderMonkey off the mozilla-central HG
-repository, or off a mirror I made of its SpiderMonkey directory. The
-latter can be obtained here:
-
-http://hg.toolness.com/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 setup.py build
+
+
Building, Testing, and Installing
+
From the root of your pymonkey repository, run:
+
python setup.py build test
+
This will build the C extension and run its test suite to ensure that
+everything works properly.
Then run:
sudo python setup.py install
Note that if you’re on Windows, you won’t need the sudo bit.
-
You can run the test suite by entering:
-
Challenges
@@ -155,7 +147,7 @@
- Pymonkey Documentation
diff -r 9d4cd0803df5 -r 1e6523de9df1 docs/rendered/searchindex.js
--- a/docs/rendered/searchindex.js Sun Aug 16 11:44:49 2009 -0700
+++ b/docs/rendered/searchindex.js Sun Aug 16 12:53:46 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:[],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","pymonkey — 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,new_object: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:[],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:[],usabl:0,befor:0,mai:1,associ:1,third:[0,1],counter:1,inform:1,sandbox:0,environ:0,enter:[],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,everyth:0,realli:0,ensur:0,"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:[],facil:0,given:1,script:[],interact:1,too:0,"final":0,store:1,relationship:0,tool:[],huh:[],than:0,wide:0,kind:[],provid:0,posit:1,browser:0,pre:1,falsi:1,argument:1,packag:0,have:[0,1],tabl:0,need:0,"null":1,engin:[0,1],built:1,equival:1,latter:[],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,eas:0,involv:0,current:[0,1],onli:[0,1],just:[],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:1,easi:0,cycl:0,howev:0,blargh:[],instanc:[0,1],context:[0,1],logic:0,freeli:1,com:[],private_obj:1,simpli:[],within:1,sweep:0,header:0,assum:1,duplic:0,quit:0,java:0,creat:[0,1],three:1,mark:0,clear_object_priv:[0,1],ani:[0,1],func:1,straight:0,durat:1,defin:[0,1],error:1,advantag:0,unintuit:[],readm:[],contributor:0,blah:[],develop:0,parti:0,make:0,belong:1,cross:0,same:1,complex:0,document:[0,1],http:[],wherea:0,effect:1,hand:0,fairli:0,moment:[],rais:1,stack:[0,1],pymonkei:[0,1],off:[],macro:0,without:0,thi:[0,1],undefin:1,programm:0,model:0,know:[],new_funct:1,execut:[0,1],less:0,obtain:[],languag:0,web:0,expos:0,except:1,add:[],valid:0,around:0,read:0,swig:0,envis:0,capi:0,world:0,bit:0,like:[0,1],vibrant:0,manual:0,resolv:0,server:0,collect:0,either:[],docutil:1,page:0,right:[],some:0,back:[],global:1,mirror:[],librari:0,rhino:0,refer:0,run:0,garbag:0,broken:0,repositori:0,about:0,actual:0,manag:[],runtm:1,due:0,serverj:0,wrap:1,your:0,span:1,wai:0,ergonom:0,custom:0,avail:0,interfac:1,low:1,lot:0,suit:0,"function":[0,1],properli:0,offer:1,tupl:1,globalobj:1,line:1,"true":1,count:0,made:0,possibl:0,similar:0,featur:0,evalu:1,doesn:[0,1],repres:1,exist:[0,1],file:[0,1],check:[],probabl:0,boop:[],todo:[],when:1,field:0,other:[0,1],test:0,you:[0,1],boof:[],matur:0,relat:1,eval:1,unbind:1,land:[0,1],sphinx:0,directori:[],obj:1,time:0},titles:["Pymonkey Documentation","pymonkey — 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
diff -r 9d4cd0803df5 -r 1e6523de9df1 docs/src/index.txt
--- a/docs/src/index.txt Sun Aug 16 11:44:49 2009 -0700
+++ b/docs/src/index.txt Sun Aug 16 12:53:46 2009 -0700
@@ -66,21 +66,15 @@
* Finally, Atul has never really made a straight Python CAPI module
before, so he wanted to give it a try.
-Building and Testing
-====================
+Building, Testing, and Installing
+=================================
-You can either build SpiderMonkey off the mozilla-central HG
-repository, or off a mirror I made of its SpiderMonkey directory. The
-latter can be obtained here:
+From the root of your pymonkey repository, run::
- http://hg.toolness.com/spidermonkey/
+ python setup.py build test
-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 setup.py build
+This will build the C extension and run its test suite to ensure that
+everything works properly.
Then run::
@@ -88,10 +82,6 @@
Note that if you're on Windows, you won't need the ``sudo`` bit.
-You can run the test suite by entering::
-
- python setup.py test
-
Challenges
==========
diff -r 9d4cd0803df5 -r 1e6523de9df1 setup.py
--- a/setup.py Sun Aug 16 11:44:49 2009 -0700
+++ b/setup.py Sun Aug 16 12:53:46 2009 -0700
@@ -59,6 +59,8 @@
SPIDERMONKEY_MAKEFILE = os.path.join(SPIDERMONKEY_OBJDIR, 'Makefile')
+DOCTEST_OUTPUT_DIR = os.path.join(BUILD_DIR, 'doctest_output')
+
setup_options = dict(
name='pymonkey',
version='0.0.1',
@@ -155,6 +157,13 @@
sys.exit(retval)
@task
+@needs('build_spidermonkey', 'setuptools.command.build')
+def build(options):
+ """Builds the pymonkey extension."""
+
+ pass
+
+@task
def build_docs(options):
"""Build the Pymonkey documentation (requires Sphinx)."""
@@ -165,7 +174,16 @@
if retval:
sys.exit(retval)
+def get_lib_dir():
+ # This is really weird and hacky; it ought to be much easier
+ # to figure out the default directory that distutils builds
+ # its C extension modules in.
+ return [os.path.join(BUILD_DIR, name)
+ for name in os.listdir(BUILD_DIR)
+ if name.startswith("lib.")][0]
+
@task
+@needs('build')
def test(options):
"""Test the Pymonkey Python C extension."""
@@ -174,6 +192,20 @@
new_env = {}
new_env.update(os.environ)
+ def append_path(env_var, path):
+ paths = new_env.get(env_var, '').split(os.path.pathsep)
+ paths.append(path)
+ new_env[env_var] = os.path.pathsep.join(paths)
+
+ # We have to add our build directory to the python path so that
+ # our tests can find the pymonkey module.
+ append_path('PYTHONPATH', get_lib_dir())
+
+ if sys.platform == 'win32':
+ # If we're on Windows, ensure that the SpiderMonkey DLL
+ # can be loaded.
+ append_path('PATH', SPIDERMONKEY_OBJDIR)
+
result = subprocess.call(
[sys.executable,
"test_pymonkey.py"],
@@ -185,13 +217,10 @@
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"],
+ DOCTEST_OUTPUT_DIR],
env = new_env)
if retval:
sys.exit(retval)