Commits

Anselm Kruis committed 89c74ae

Convert the "stackless-python" distribution into an umbrella installer.
Fix the installation with pip.

Comments (0)

Files changed (3)

 <pydev_project>
 <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">python2.7</pydev_property>
 <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
+<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
+<path>/slp-installer2</path>
+</pydev_pathproperty>
 </pydev_project>
 import sys
 try:
     from setuptools import setup
-    from setuptools.dist import Distribution
+    from setuptools.command.install_lib import install_lib
 except ImportError:
     from distutils.core import setup
-    Distribution = lambda x: None
-
-installerVersion = (10,0)  # bigger than any previous version and any python version
-installerVersionStr = ".".join(map(str,installerVersion))
-
-
-from distutils.command.install_lib import install_lib
+    from distutils.command.install_lib import install_lib
 from distutils import log
 
+from stackless_python_umbrella import INSTALLER_VERSION, get_dependency_links, get_stackless_package
+
+installerVersionStr = ".".join(map(str,INSTALLER_VERSION))
+
+# the installation of the module stackless_python_umbrella ensures, that 
+# the install_lib command runs during the installation of this distribution
 class InstallWithScript(install_lib):
     def run(self):
         result = install_lib.run(self)
             log.info("Installed Stackless Python")
         return result
 
-def get_stackless_package():
-    """
-    Compute the required Stackless-Python package.
-    
-    This method returns a string pair (name, version-specifier). 
-    If the package :mod:`stackless` is already available, the method
-    returns (None,None). 
-    """
-    from distutils.util import get_platform
-    import sys
-    
-    # Python version check
-    try:
-        import stackless
-    except ImportError:
-        # fine, it is not Stackless Python or pypy
-        pass
-    else:
-        log.info("Your Python version already provides the package 'stackless'")
-        return None,None
-    
-    reqVersionMin = '.'.join(map(str,sys.version_info[:3]))
-    vi = list(sys.version_info[:3])
-    vi[-1] += 1
-    reqVersionMax = '.'.join(map(str,vi))
-    reqVersion = ">=%s,<%s" % (reqVersionMin, reqVersionMax)
-    
-    ucs = 4 if sys.maxunicode >> 16 else 2
-    
-    installer = None
-
-    platform = get_platform()
-    
-    # check for PyPy. It uses the same platform values as CPython
-    if getattr(sys, 'pypy_version_info', None):
-        # older PyPy without stackless 
-        raise RuntimeError("PyPy is not supported")
-    
-    # Jython
-    elif platform.startswith("java"):
-        raise NotImplementedError("Platform %s not yet supported" % (platform,))
-
-    # Naming scheme
-    #  - "stackless_installer" fixed
-    #  - "C..." configuration details, currently only the ucs setting
-    #  - "platform"
-    installer = "stackless_installer_C%d_%s" % (ucs, platform.replace("-", "_"))
-
-    return installer, reqVersion
 
 
 # various variables for setup(...)
 cmdclass={}
 setup_requires = []
-dependency_links = [ "http://bitbucket.org/akruis/slp-installer/downloads" ]
+dependency_links = []
 
 installer, reqVersion = get_stackless_package() 
 if installer is not None:
     cmdclass['install_lib'] = InstallWithScript
     setup_requires.append(installer+reqVersion)
-
-# Distribution(dict(setup_requires=setup_requires, dependency_links=dependency_links))
-# `setup_requires` is parsed and acted upon immediately; from here on out
-# the yoursharedsetuppackage is installed and importable.
+    dependency_links.extend(get_dependency_links(installer, reqVersion))
        
 setup(
     cmdclass=cmdclass,
     #install_requires = setup_requires,  # uncomment to install the installer permanently 
     requires = [], # no requirements
     dependency_links = dependency_links,
+    py_modules = ['stackless_python_umbrella'],
     long_description=open("README.rst").read(),
     classifiers=[
           "License :: OSI Approved :: Apache Software License", # for this umbrella installer

stackless_python_umbrella.py

+#
+# Copyright 2013 Anselm Kruis
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+'''
+Common code of the Stackless Python installer.
+'''
+
+DEFAULT_DEPENDENCY_LINKS = [ "http://bitbucket.org/akruis/slp-installer/downloads" ]
+INSTALLER_VERSION = (0,3)
+
+def get_stackless_package():
+    """
+    Compute the required Stackless-Python package.
+    
+    This method returns a string pair (name, version-specifier). 
+    If the package :mod:`stackless` is already available, the method
+    returns (None,None). 
+    """
+    from distutils.util import get_platform
+    from distutils import log
+    import sys
+    
+    # Python version check
+    try:
+        import stackless
+    except ImportError:
+        # fine, it is not Stackless Python or pypy
+        pass
+    else:
+        log.info("Your Python version already provides the package 'stackless'")
+        return None,None
+    
+    reqVersionMin = '.'.join(map(str,sys.version_info[:3]))
+    vi = list(sys.version_info[:3])
+    vi[-1] += 1
+    reqVersionMax = '.'.join(map(str,vi))
+    reqVersion = ">=%s,<%s" % (reqVersionMin, reqVersionMax)
+    
+    ucs = 4 if sys.maxunicode >> 16 else 2
+    
+    platform = get_platform()
+    
+    # check for PyPy. It uses the same platform values as CPython
+    if getattr(sys, 'pypy_version_info', None):
+        # older PyPy without stackless 
+        raise RuntimeError("PyPy is not supported")
+    
+    # Jython
+    elif platform.startswith("java"):
+        raise NotImplementedError("Platform %s not yet supported" % (platform,))
+
+    # Naming scheme
+    #  - "stackless_installer" fixed
+    #  - "C..." configuration details, currently only the ucs setting
+    #  - "platform"
+    installer = "stackless_installer_C%d_%s" % (ucs, platform.replace("-", "_"))
+
+    return installer, reqVersion
+
+def get_dependency_links(installer, reqVersion):
+    return DEFAULT_DEPENDENCY_LINKS
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.