~j5-dev/+junk/setuptools-0.6c11

« back to all changes in this revision

Viewing changes to setuptools/command/install_egg_info.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-11-02 10:57:34 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20071102105734-g1hb871hwrvjsw60
Tags: 0.6c7-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
            return dst
57
57
        unpack_archive(self.source, self.target, skimmer)
58
58
 
 
59
 
 
60
 
 
61
 
 
62
 
 
63
 
 
64
 
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70
 
 
71
 
 
72
 
 
73
 
 
74
 
 
75
 
 
76
 
 
77
 
 
78
 
 
79
 
 
80
 
 
81
 
 
82
 
59
83
    def install_namespaces(self):
60
84
        nsp = self._get_all_ns_packages()
61
85
        if not nsp: return
66
90
            f = open(filename,'wb')
67
91
            for pkg in nsp:
68
92
                pth = tuple(pkg.split('.'))
 
93
                trailer = '\n'
 
94
                if '.' in pkg:
 
95
                    trailer = (
 
96
                        "; m and setattr(sys.modules[%r], %r, m)\n"
 
97
                        % ('.'.join(pth[:-1]), pth[-1])
 
98
                    )
69
99
                f.write(
70
100
                    "import sys,new,os; "
71
101
                    "p = os.path.join(sys._getframe(1).f_locals['sitedir'], "
74
104
                    "m = not ie and "
75
105
                        "sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); "
76
106
                    "mp = (m or []) and m.__dict__.setdefault('__path__',[]); "
77
 
                    "(p not in mp) and mp.append(p)\n"
 
107
                    "(p not in mp) and mp.append(p)%(trailer)s"
78
108
                    % locals()
79
109
                )
80
110
            f.close()
81
111
 
82
 
 
83
112
    def _get_all_ns_packages(self):
84
113
        nsp = {}
85
114
        for pkg in self.distribution.namespace_packages or []:
92
121
        return nsp
93
122
 
94
123
 
95
 
 
96
 
 
97
 
 
98
 
 
99
 
 
100
 
 
101
 
 
102
 
 
103
 
 
104
 
 
105
 
 
106
 
 
107
 
 
108
 
 
109
 
 
110
 
 
111
 
 
112
 
 
113
 
 
114
 
 
115
 
 
116
 
 
117
 
 
118
 
 
119
 
 
120
 
 
121
 
 
122
 
 
123