Re: docs.zope.org automation

Chris Withers <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Jens Vagelpohl wrote:
>> I've just been doing some build and release tools for a customer that
>> involve this sort of stuff, I resorted to:
> <snip lots of code>
> 
> Yikes. Maybe the subshell isn't so bad after all :-P

Yeah ;-) Although getting the right python path set up can be a pain...

Here's the actual version I use to do an in-process sdist:

     try:
         orig_argv = sys.argv
         orig_stdout,orig_stderr = sys.stdout,sys.stderr
         curdir = os.getcwd()
         sys.argv = sys.argv[0:1]+['egg_info',
                                   '--tag-svn-revision',
                                   '--tag-date',
                                   'sdist']
         sys.path.insert(0,location)
         os.chdir(location)
         sys.stdout,sys.stderr = StringIO(),StringIO()
         # yuk, but setup.py is yuk anyway!
         if 'setup' in sys.modules:
             del sys.modules['setup']
         import setup
     finally:
         os.chdir(curdir)
         sys.path.pop(0)
         sys.stdout,sys.stderr = orig_stdout,orig_stderr
         sys.argv = orig_argv

cheers,

Chris

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.