Mercurial > cpython-lru_cache-weakref
annotate Lib/distutils/command/command_template @ 87690:66c1c9f32567 default tip
Add use_weakref option to functools.lru_cache
The use_weakref option makes lru_cache create weak references to the function
arguments when creating the cache key, which prevents them from staying in the
memory forever even after all other references to them are gone.
This is a proof of concept for http://bugs.python.org/issue19859
| author | Radomir Dopieralski <devel@sheep.art.pl> |
|---|---|
| date | Tue, 03 Dec 2013 16:02:48 +0100 |
| parents | a6d3930b5613 |
| children |
| rev | line source |
|---|---|
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
1 """distutils.command.x |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
2 |
| 12795 | 3 Implements the Distutils 'x' command. |
| 4 """ | |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
5 |
|
12708
35305991719b
Changed default developer name.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12707
diff
changeset
|
6 # created 2000/mm/dd, John Doe |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
7 |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
8 __revision__ = "$Id$" |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
9 |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
10 from distutils.core import Command |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
11 |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
12 |
|
43026
a6d3930b5613
General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents:
12795
diff
changeset
|
13 class x(Command): |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
14 |
|
12708
35305991719b
Changed default developer name.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12707
diff
changeset
|
15 # Brief (40-50 characters) description of the command |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
16 description = "" |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
17 |
|
12708
35305991719b
Changed default developer name.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12707
diff
changeset
|
18 # List of option tuples: long name, short name (None if no short |
|
35305991719b
Changed default developer name.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12707
diff
changeset
|
19 # name), and help string. |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
20 user_options = [('', '', |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
21 ""), |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
22 ] |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
23 |
|
43026
a6d3930b5613
General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents:
12795
diff
changeset
|
24 def initialize_options(self): |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
25 self. = None |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
26 self. = None |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
27 self. = None |
|
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
28 |
|
43026
a6d3930b5613
General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents:
12795
diff
changeset
|
29 def finalize_options(self): |
|
12708
35305991719b
Changed default developer name.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12707
diff
changeset
|
30 if self.x is None: |
|
35305991719b
Changed default developer name.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12707
diff
changeset
|
31 self.x = |
|
12707
9abefc5b1d89
Template for writing Distutils command modules.
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
32 |
|
43026
a6d3930b5613
General cleanup, raise normalization in Lib/distutils.
Collin Winter <collinw@gmail.com>
parents:
12795
diff
changeset
|
33 def run(self): |
