[Zope-dev] docs.zope.org automation
Chris Withers
chris at simplistix.co.uk
Wed Aug 4 05:33:52 EDT 2010
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
More information about the Zope-Dev
mailing list