A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-November/114290.html below:

[Python-Dev] draft PEP: virtual environments

[Python-Dev] draft PEP: virtual environments"Martin v. Löwis" martin at v.loewis.de
Tue Nov 1 08:25:20 CET 2011
> Not a zip file specifically - just a binary stream which organises scripts to be
> installed. If each class in a hierarchy has access to a binary stream, then
> subclasses have access to the streams for base classes as well as their own
> stream, and can install selectively from base class streams and their own stream.
> 
> class Base:
>     scripts = ... # zip stream containing scripts A, B
> 
>     def install_scripts(self, stream):
>         # ...
> 
>     def setup_scripts(self):
>         self.install_scripts(self.scripts)
> 
> class Derived:
>     scripts = ... # zip stream containing modified script B, new script C
> 
>     def setup_scripts(self):
>         self.install_scripts(Base.scripts) # adds A, B
>         self.install_scripts(self.scripts) # adds C, overwrites B

I'm not sure how many scripts you are talking about, and how long they
are. Assuming there are free, and assuming they are short, I'd not make
them separate source files again, but put them into string literals instead:

scripts = {
  'start':'''\
#!/bin/sh
echo start
''',
  'stop':'''\
#!/bin/sh
echo stop
'''
}}}

Then, your install_scripts would take a dictionary filename:script
contents. That's just as easily extensible.

Regards,
Martin
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4