|
8 | 8 | import subprocess |
9 | 9 | import sys |
10 | 10 | import sysconfig |
| 11 | + |
| 12 | +import setuptools |
| 13 | +from distutils import log |
11 | 14 | from distutils.command.build import build |
12 | 15 | from urllib.request import urlretrieve |
13 | 16 | from setuptools import setup, find_packages, Extension |
| 17 | +from setuptools.command.develop import develop |
14 | 18 |
|
15 | 19 | with open('README.rst') as readme_file: |
16 | 20 | readme = readme_file.read() |
@@ -127,6 +131,28 @@ def filter_params(params): |
127 | 131 | super().run() |
128 | 132 |
|
129 | 133 |
|
| 134 | +class nginxpy_develop(develop): |
| 135 | + def install_for_development(self): |
| 136 | + self.reinitialize_command('build', inplace=1) |
| 137 | + self.run_command('build') |
| 138 | + |
| 139 | + self.install_site_py() # ensure that target dir is site-safe |
| 140 | + if setuptools.bootstrap_install_from: |
| 141 | + self.easy_install(setuptools.bootstrap_install_from) |
| 142 | + setuptools.bootstrap_install_from = None |
| 143 | + |
| 144 | + self.install_namespaces() |
| 145 | + |
| 146 | + # create an .egg-link in the installation dir, pointing to our egg |
| 147 | + log.info("Creating %s (link to %s)", self.egg_link, self.egg_base) |
| 148 | + if not self.dry_run: |
| 149 | + with open(self.egg_link, "w") as f: |
| 150 | + f.write(self.egg_path + "\n" + self.setup_path) |
| 151 | + # postprocess the installed distro, fixing up .pth, installing scripts, |
| 152 | + # and handling requirements |
| 153 | + self.process_distribution(None, self.dist, not self.no_deps) |
| 154 | + |
| 155 | + |
130 | 156 | nginxpy = Extension( |
131 | 157 | 'nginx._nginx', |
132 | 158 | sources=[ |
@@ -162,7 +188,7 @@ def filter_params(params): |
162 | 188 | name='nginxpy', |
163 | 189 | packages=find_packages(include=['nginx', 'nginx.asyncio', 'nginx.http']), |
164 | 190 | ext_modules=[nginxpy], |
165 | | - cmdclass=dict(build=nginxpy_build), |
| 191 | + cmdclass=dict(build=nginxpy_build, develop=nginxpy_develop), |
166 | 192 | entry_points='''\ |
167 | 193 | [nginx.modules] |
168 | 194 | 100 = nginx.asyncio:AsyncioModule |
|
0 commit comments