Jens Vagelpohl wrote:
> I understand that. But it must be possible to do that programatically in
> my code. I mean, " --long-description" obviously executes Python
> code, which I may be able to execute myself in my current interpreter
> session by importing and executing stuff from setuptools.

Yeah, this is why sucks ;-)

I've just been doing some build and release tools for a customer that 
involve this sort of stuff, I resorted to:

         with nested(Replacer(),OutputCapture()) as (r,o):
                 curdir = os.getcwd()
                 # yuk, but is yuk anyway!
                 if 'setup' in sys.modules:
                     del sys.modules['setup']
                 import setup
                 sys.path.pop(0) my tests, the del from sys.modules is to allow this to by done 
multiple times in one process.

Replacer is

OutputCapture looks like:

class OutputCapture:

     def __enter__(self):
         self.original_stdout = sys.stdout
         self.original_stderr = sys.stderr
         self.output = sys.stdout = sys.stderr = StringIO()
         return self

     def __exit__(self,*args):
         sys.stdout = self.original_stdout
         sys.stderr = self.original_stderr

     def compare(self,expected):

 > Having to
> invoke another Python interpreter in a subshell because that's too
> complicated to do any other way is awful.

Yeah, I do resort to this for some things too ;-)



Zope-Dev maillist  -
**  No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to