Skip to content

Commit 71ca29d

Browse files
committed
Fix development process
1 parent 76c09a8 commit 71ca29d

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

README.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,20 @@ Installation
5151
``python setup.py build`` first.
5252
3. Run ``python -c 'import nginx'`` to get NGINX configuration hint.
5353
4. Update NGINX configuration accordingly and reload NGINX.
54-
5. See NGINX ``error.log`` for now.
54+
5. Visit your NGINX site, see NGINX ``error.log`` for now.
5555

5656

5757
Development
5858
-----------
5959

6060
1. Install NGINX in whatever way, make sure ``nginx`` command is available.
6161
2. Checkout source code.
62-
3. Run ``python setup.py build`` and ``python setup.py develop``.
62+
3. Run ``python setup.py develop``.
6363
4. Run ``python -c 'import nginx'`` to get NGINX configuration hint.
6464
5. Update NGINX configuration accordingly and reload NGINX.
65-
6. See NGINX ``error.log`` for now.
65+
6. Visit your NGINX site, see NGINX ``error.log`` for now.
66+
7. Change code if result is not satisfying, or else go for pull request.
67+
8. Goto 3 if Cython code was changed, or else goto 5.
6668

6769
Surprisingly NGINX has a very simple but powerful architecture, learn about it
6870
here: http://nginx.org/en/docs/dev/development_guide.html

setup.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
import subprocess
99
import sys
1010
import sysconfig
11+
12+
import setuptools
13+
from distutils import log
1114
from distutils.command.build import build
1215
from urllib.request import urlretrieve
1316
from setuptools import setup, find_packages, Extension
17+
from setuptools.command.develop import develop
1418

1519
with open('README.rst') as readme_file:
1620
readme = readme_file.read()
@@ -127,6 +131,28 @@ def filter_params(params):
127131
super().run()
128132

129133

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+
130156
nginxpy = Extension(
131157
'nginx._nginx',
132158
sources=[
@@ -162,7 +188,7 @@ def filter_params(params):
162188
name='nginxpy',
163189
packages=find_packages(include=['nginx', 'nginx.asyncio', 'nginx.http']),
164190
ext_modules=[nginxpy],
165-
cmdclass=dict(build=nginxpy_build),
191+
cmdclass=dict(build=nginxpy_build, develop=nginxpy_develop),
166192
entry_points='''\
167193
[nginx.modules]
168194
100 = nginx.asyncio:AsyncioModule

0 commit comments

Comments
 (0)