Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WIP

git-svn-id: svn://cherokee-project.com/wizards2@6898 5dc97367-97f1-0310-9951-d761b3857238
  • Loading branch information...
commit 502fb82178d18db5f0d76e727e406c15b5713205 1 parent ab2b854
@alobbs alobbs authored
View
2  __init__.py
@@ -23,7 +23,7 @@
#
import Categories
-
+import common
#
# Add the current dir to the Python path
View
25 common/__init__.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8; mode: python -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+#
+# Copyright (C) 2001-2011 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import python
View
119 common/python.py
@@ -0,0 +1,119 @@
+# -*- coding: utf-8; mode: python -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+#
+# Copyright (C) 2001-2011 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+"""
+Detection of Python interpreter in the system.
+"""
+
+import os
+import re
+import CTK
+import popen
+
+from util import *
+
+PYTHON_BINS = [
+ 'python',
+ 'python2',
+ 'python2.7',
+ 'python2.6',
+ 'python2.5',
+ 'python2.4',
+]
+
+DEFAULT_PATHS = [
+ '/usr/bin',
+ '/usr/sfw/bin',
+ '/usr/gnu/bin',
+ '/usr/local/bin',
+ '/opt/local/bin',
+ '/opt/python*/bin',
+ '/usr/local/python*/bin',
+ '/usr/python*/bin',
+]
+
+
+def _is_bin_version (bin, required_version):
+ ret = popen.popen_sync ("'%s' -V"%(bin))
+
+ tmp = re.findall (r'Python ([\d.]+)', ret['stderr'], re.M)
+ if not tmp: return
+
+ v_int = version_to_int (tmp[0])
+ r_int = version_to_int (required_version)
+
+ return v_int >= r_int
+
+
+def _test_py24(s):
+ return _is_bin_version (s, '2.4.0')
+
+def _test_py25(s):
+ return _is_bin_version (s, '2.5.0')
+
+def _test_py26(s):
+ return _is_bin_version (s, '2.6.0')
+
+def _test_py27(s):
+ return _is_bin_version (s, '2.7.0')
+
+
+def find_python (version, or_greater):
+ """Report Python interpeter of specified version. The or_greater
+ parameter indicates whether higher versions should also be
+ accepted or not.
+
+ find_python() returns the absolute path to the binary of the
+ interpreter found."""
+
+ tmp = version.split('.')
+ ver = int(''.join(tmp[0:2]))
+
+ if ver <= 27 or or_greater:
+ python27 = path_find_binary (PYTHON_BINS,
+ extra_dirs = DEFAULT_PATHS,
+ custom_test = _test_py27)
+ if python27:
+ return python27
+
+ if ver <=26 or or_greater:
+ python26 = path_find_binary (PYTHON_BINS,
+ extra_dirs = DEFAULT_PATHS,
+ custom_test = _test_py26)
+ if python26:
+ return python26
+
+ if ver <= 25 or or_greater:
+ python25 = path_find_binary (PYTHON_BINS,
+ extra_dirs = DEFAULT_PATHS,
+ custom_test = _test_py25)
+ if python25:
+ return python25
+
+ if ver <= 24 or or_greater:
+ python24 = path_find_binary (PYTHON_BINS,
+ extra_dirs = DEFAULT_PATHS,
+ custom_test = _test_py24)
+ if python24:
+ return python24
View
48 templates/Python.py
@@ -0,0 +1,48 @@
+
+# -*- coding: utf-8; mode: python -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+#
+# Copyright (C) 2001-2011 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import os
+import re
+import CTK
+import vserver
+import Wizard2
+import Wizard2_GUI
+import popen
+
+from util import *
+from wizards2.common import python
+
+class Install (Wizard2.Wizard):
+ def __init__ (self, app_info, config_vserver, config_directory, params=None):
+ # Base
+ Wizard2.Wizard.__init__ (self, app_info, params)
+
+ # Properties
+ self._config_vserver = config_vserver
+ self._config_directory = config_directory
+
+ # Sibling wizard
+ self.python_int = python.find_python ('2.4.0', or_greater = True)
+ print "self.python_int", self.python_int
View
66 wizards/django.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8; mode: python -*-
+#
+# Cherokee-admin
+#
+# Authors:
+# Alvaro Lopez Ortega <alvaro@alobbs.com>
+#
+# Copyright (C) 2001-2011 Alvaro Lopez Ortega
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of version 2 of the GNU General Public
+# License as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+
+import CTK
+import vserver
+import Wizard2
+import Wizard2_GUI as GUI
+
+from util import *
+
+python_tpl = Wizard2.Load_Template ('Python.py')
+
+DESC_SHORT = """
+Django is..
+"""
+
+software = {
+ 'id': 'django',
+ 'name': 'Django',
+ 'author': 'Django Community',
+ 'URL': 'http://www.djangoproject.com/',
+ 'icon_small': 'django_x96.png',
+ 'category': 'Frameworks',
+ 'packager_name': 'Alvaro Lopez Ortega',
+ 'packager_email': 'alvaro@alobbs.com',
+ 'desc_short': DESC_SHORT,
+}
+
+
+#
+# Installer
+#
+class Install (python_tpl.Install):
+ def __init__ (self, params):
+ python_tpl.Install.__init__ (self,
+ app_info = {},
+ config_vserver = CONFIG_VSERVER,
+ config_directory = CONFIG_DIR,
+ params = params)
+
+
+#
+# GUI
+#
+GUI.Register_Standard_GUI (software, Install, None)
Please sign in to comment.
Something went wrong with that request. Please try again.