Skip to content

Commit

Permalink
Get setup_requires working by making separate commands instead of sub…
Browse files Browse the repository at this point in the history
…classing.

Fixes #9.
  • Loading branch information
rpatterson committed Oct 30, 2012
1 parent 046e0eb commit a090f2f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 49 deletions.
2 changes: 1 addition & 1 deletion examples/pyramid.msdeploy/Manifest.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<msDeploy.iisApp>
<iisApp path="%DIST_NAME%" />
<runCommand
path="%SystemDrive%\Python27\Scripts\iiswsgi_install.exe -v -e -a %DIST_NAME% install_msdeploy"
path="%SystemDrive%\Python27\Scripts\iiswsgi_install.exe -v -e -a %DIST_NAME% install_pyramid_msdeploy"
waitAttempts="10" waitInterval="60000" successReturnCodes="0x0"
MSDeploy.MSDeployKeyAttributeName="path" />
</msDeploy.iisApp>
8 changes: 6 additions & 2 deletions examples/pyramid.msdeploy/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[global]
command_packages = iiswsgi

[install_msdeploy]
[install_pyramid]
scaffold = __msdeploy_scaffold__
project = __msdeploy_project__

[test_msdeploy]
config_file = __msdeploy_project__\development.ini

[aliases]
release = bdist_msdeploy check register upload
release =
build_msdeploy install_pyramid_msdeploy bdist_msdeploy
check register upload
install_pyramid_msdeploy =
develop install_pyramid test_msdeploy install_msdeploy
24 changes: 10 additions & 14 deletions examples/pyramid.msdeploy/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,36 @@
import subprocess
import sysconfig

from setuptools import setup
from distutils import cmd

from iiswsgi import install_msdeploy
from setuptools import setup

version = '0.2'


class install_pyramid_msdeploy(install_msdeploy.install_msdeploy):
# NameError under distutils.core.run_setup
from iiswsgi import install_msdeploy
class install_pyramid(cmd.Command):

scaffold = 'starter'
project = 'MyProject'

user_options = install_msdeploy.install_msdeploy.user_options + [
user_options = [
('scaffold', 's',
'The Pyramid scaffold to use to create the project. [default: {0}]'
.format(scaffold)),
('project', 's',
'The name of the project to create. [default: {0}]'
.format(project))]

def initialize_options(self):
self.scaffold = None

def finalize_options(self):
"""Handle unreplaced parameters when testing locally."""
install_msdeploy.install_msdeploy.finalize_options(self)
if self.scaffold == '__msdeploy_scaffold__':
if not self.scaffold or self.scaffold == '__msdeploy_scaffold__':
self.scaffold = 'starter'

def run(self):
"""Add a project from a project before testing."""
self.pre_install()

"""Add a project from a scaffold."""
logger = logging.getLogger('pyramid.iiswsgi')
cwd = os.getcwd()

Expand All @@ -56,8 +54,6 @@ def run(self):
finally:
os.chdir(cwd)

self.post_install()


setup(name='PyramidIISApp',
version=version,
Expand All @@ -81,5 +77,5 @@ def run(self):
install_requires=['iiswsgi', 'pyramid'],
setup_requires=['iiswsgi'],
install_msdeploy=['virtualenv'],
cmdclass=dict(install_msdeploy=install_pyramid_msdeploy),
cmdclass=dict(install_pyramid=install_pyramid),
)
40 changes: 8 additions & 32 deletions iiswsgi/install_msdeploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,50 +54,26 @@ def run(self, *requirements):
"""
Run all post-MSDeploy tasks as appropriate.
`self.pre_install()`
Run install tasks before custom setup.
`self.post_install()`
Run install tasks after custom setup.
To excercise custom control over installation, override this
method in a subclass and use:
setup(...
cmdclass=dict(install_msdeploy=<install_msdeploy_subclass>)...
"""
self.pre_install()
self.post_install()

def pre_install(self):
"""
Run install tasks before custom setup.
`setyp.py develop`:
Install any requirements using easy_install.
`self.write_web_config()`:
Write variable substitutions into `web.config`.
"""
self.run_command('develop')
self.write_web_config()

def post_install(self):
"""
Run install tasks after custom setup.
`setup.py test_msdeploy`:
Test a WSGI app prior to completing installation.
`iiswsgi.fcgi.install_fcgi_app()`:
Install an IIS FastCGI application.
To excercise custom control over installation, override this
method in a subclass and use:
setup(...
cmdclass=dict(install_msdeploy=<install_msdeploy_subclass>)...
"""
self.run_command('develop')
self.write_web_config()
if not self.skip_fcgi_app_install:
fcgi.install_fcgi_app()

Expand Down

0 comments on commit a090f2f

Please sign in to comment.