| 120 | ] |
| 121 | |
| 122 | def initialize_options(self): |
| 123 | # initialize_options() may be called multiple times on the |
| 124 | # same command object, so make sure not to override previously |
| 125 | # set options. |
| 126 | if getattr(self, '_initialized', False): |
| 127 | return |
| 128 | |
| 129 | super(build_ext, self).initialize_options() |
| 130 | |
| 131 | defines = [ |
| 132 | "CYTHON_USE_MODULE_STATE", |
| 133 | "CYTHON_PEP489_MULTI_PHASE_INIT", |
| 134 | "CYTHON_USE_TYPE_SPECS", |
| 135 | ] |
| 136 | |
| 137 | if os.environ.get('ASYNCPG_DEBUG'): |
| 138 | self.cython_always = True |
| 139 | self.cython_annotate = True |
| 140 | self.cython_directives = "linetrace=True" |
| 141 | self.debug = True |
| 142 | |
| 143 | defines += ["PG_DEBUG", "CYTHON_TRACE", "CYTHON_TRACE_NOGIL"] |
| 144 | else: |
| 145 | self.cython_always = False |
| 146 | self.cython_annotate = None |
| 147 | self.cython_directives = None |
| 148 | |
| 149 | self.define = ",".join(defines) |
| 150 | |
| 151 | def finalize_options(self): |
| 152 | # finalize_options() may be called multiple times on the |