diff options
author | Andreas Mantke <maand@gmx.de> | 2011-04-24 10:58:10 +0200 |
---|---|---|
committer | Andreas Mantke <maand@gmx.de> | 2011-04-24 10:58:10 +0200 |
commit | a83e4421d84700b6ed38cd2044e6e76f54fe175d (patch) | |
tree | d48d4d0a34bbfd126b83068273d0a24e86e8c7ed | |
parent | f9fafcea8a53fc3cdb786824a5e0ea77b2163a00 (diff) |
Initial commit of config.py, interfaces.py, permissions.py, pypi.py, setuphandlers.py trove.py, TROVE.txt, utils.py, validators.py and the compiled versions
17 files changed, 1525 insertions, 0 deletions
diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/TROVE.txt b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/TROVE.txt new file mode 100644 index 0000000..05f8743 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/TROVE.txt @@ -0,0 +1,501 @@ +Development Status :: 1 - Planning +Development Status :: 2 - Pre-Alpha +Development Status :: 3 - Alpha +Development Status :: 4 - Beta +Development Status :: 5 - Production/Stable +Development Status :: 6 - Mature +Development Status :: 7 - Inactive +Environment :: Console +Environment :: Console :: Curses +Environment :: Console :: Framebuffer +Environment :: Console :: Newt +Environment :: Console :: svgalib +Environment :: Handhelds/PDA's +Environment :: MacOS X +Environment :: MacOS X :: Aqua +Environment :: MacOS X :: Carbon +Environment :: MacOS X :: Cocoa +Environment :: No Input/Output (Daemon) +Environment :: Other Environment +Environment :: Plugins +Environment :: Web Environment +Environment :: Web Environment :: Mozilla +Environment :: Win32 (MS Windows) +Environment :: X11 Applications +Environment :: X11 Applications :: Gnome +Environment :: X11 Applications :: GTK +Environment :: X11 Applications :: KDE +Environment :: X11 Applications :: Qt +Intended Audience :: Customer Service +Intended Audience :: Developers +Intended Audience :: Education +Intended Audience :: End Users/Desktop +Intended Audience :: Financial and Insurance Industry +Intended Audience :: Healthcare Industry +Intended Audience :: Information Technology +Intended Audience :: Legal Industry +Intended Audience :: Manufacturing +Intended Audience :: Other Audience +Intended Audience :: Religion +Intended Audience :: Science/Research +Intended Audience :: System Administrators +Intended Audience :: Telecommunications Industry +License :: Aladdin Free Public License (AFPL) +License :: DFSG approved +License :: Eiffel Forum License (EFL) +License :: Free For Educational Use +License :: Free For Home Use +License :: Free for non-commercial use +License :: Freely Distributable +License :: Free To Use But Restricted +License :: Freeware +License :: Netscape Public License (NPL) +License :: Nokia Open Source License (NOKOS) +License :: OSI Approved +License :: OSI Approved :: Academic Free License (AFL) +License :: OSI Approved :: Apache Software License +License :: OSI Approved :: Apple Public Source License +License :: OSI Approved :: Artistic License +License :: OSI Approved :: Attribution Assurance License +License :: OSI Approved :: BSD License +License :: OSI Approved :: Common Public License +License :: OSI Approved :: Eiffel Forum License +License :: OSI Approved :: GNU Free Documentation License (FDL) +License :: OSI Approved :: GNU General Public License (GPL) +License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) +License :: OSI Approved :: IBM Public License +License :: OSI Approved :: Intel Open Source License +License :: OSI Approved :: Jabber Open Source License +License :: OSI Approved :: MIT License +License :: OSI Approved :: MITRE Collaborative Virtual Workspace License (CVW) +License :: OSI Approved :: Motosoto License +License :: OSI Approved :: Mozilla Public License 1.0 (MPL) +License :: OSI Approved :: Mozilla Public License 1.1 (MPL 1.1) +License :: OSI Approved :: Nethack General Public License +License :: OSI Approved :: Nokia Open Source License +License :: OSI Approved :: Open Group Test Suite License +License :: OSI Approved :: Python License (CNRI Python License) +License :: OSI Approved :: Python Software Foundation License +License :: OSI Approved :: Qt Public License (QPL) +License :: OSI Approved :: Ricoh Source Code Public License +License :: OSI Approved :: Sleepycat License +License :: OSI Approved :: Sun Industry Standards Source License (SISSL) +License :: OSI Approved :: Sun Public License +License :: OSI Approved :: University of Illinois/NCSA Open Source License +License :: OSI Approved :: Vovida Software License 1.0 +License :: OSI Approved :: W3C License +License :: OSI Approved :: X.Net License +License :: OSI Approved :: zlib/libpng License +License :: OSI Approved :: Zope Public License +License :: Other/Proprietary License +License :: Public Domain +Natural Language :: Afrikaans +Natural Language :: Arabic +Natural Language :: Bengali +Natural Language :: Bosnian +Natural Language :: Bulgarian +Natural Language :: Catalan +Natural Language :: Chinese (Simplified) +Natural Language :: Chinese (Traditional) +Natural Language :: Croatian +Natural Language :: Czech +Natural Language :: Danish +Natural Language :: Dutch +Natural Language :: English +Natural Language :: Esperanto +Natural Language :: Finnish +Natural Language :: French +Natural Language :: German +Natural Language :: Greek +Natural Language :: Hebrew +Natural Language :: Hindi +Natural Language :: Hungarian +Natural Language :: Icelandic +Natural Language :: Indonesian +Natural Language :: Italian +Natural Language :: Japanese +Natural Language :: Javanese +Natural Language :: Korean +Natural Language :: Latin +Natural Language :: Latvian +Natural Language :: Macedonian +Natural Language :: Malay +Natural Language :: Marathi +Natural Language :: Norwegian +Natural Language :: Panjabi +Natural Language :: Persian +Natural Language :: Polish +Natural Language :: Portuguese +Natural Language :: Portuguese (Brazilian) +Natural Language :: Romanian +Natural Language :: Russian +Natural Language :: Serbian +Natural Language :: Slovak +Natural Language :: Slovenian +Natural Language :: Spanish +Natural Language :: Swedish +Natural Language :: Tamil +Natural Language :: Telugu +Natural Language :: Thai +Natural Language :: Turkish +Natural Language :: Ukranian +Natural Language :: Urdu +Natural Language :: Vietnamese +Operating System :: BeOS +Operating System :: MacOS +Operating System :: MacOS :: MacOS 9 +Operating System :: MacOS :: MacOS X +Operating System :: Microsoft +Operating System :: Microsoft :: MS-DOS +Operating System :: Microsoft :: Windows +Operating System :: Microsoft :: Windows :: Windows 3.1 or Earlier +Operating System :: Microsoft :: Windows :: Windows 95/98/2000 +Operating System :: Microsoft :: Windows :: Windows CE +Operating System :: Microsoft :: Windows :: Windows NT/2000 +Operating System :: OS/2 +Operating System :: OS Independent +Operating System :: Other OS +Operating System :: PalmOS +Operating System :: PDA Systems +Operating System :: POSIX +Operating System :: POSIX :: AIX +Operating System :: POSIX :: BSD +Operating System :: POSIX :: BSD :: BSD/OS +Operating System :: POSIX :: BSD :: FreeBSD +Operating System :: POSIX :: BSD :: NetBSD +Operating System :: POSIX :: BSD :: OpenBSD +Operating System :: POSIX :: GNU Hurd +Operating System :: POSIX :: HP-UX +Operating System :: POSIX :: IRIX +Operating System :: POSIX :: Linux +Operating System :: POSIX :: Other +Operating System :: POSIX :: SCO +Operating System :: POSIX :: SunOS/Solaris +Operating System :: Unix +Programming Language :: Ada +Programming Language :: APL +Programming Language :: ASP +Programming Language :: Assembly +Programming Language :: Awk +Programming Language :: Basic +Programming Language :: C +Programming Language :: C# +Programming Language :: C++ +Programming Language :: Cold Fusion +Programming Language :: Delphi/Kylix +Programming Language :: Dylan +Programming Language :: Eiffel +Programming Language :: Emacs-Lisp +Programming Language :: Erlang +Programming Language :: Euler +Programming Language :: Euphoria +Programming Language :: Forth +Programming Language :: Fortran +Programming Language :: Haskell +Programming Language :: Java +Programming Language :: JavaScript +Programming Language :: Lisp +Programming Language :: Logo +Programming Language :: ML +Programming Language :: Modula +Programming Language :: Objective C +Programming Language :: Object Pascal +Programming Language :: OCaml +Programming Language :: Other +Programming Language :: Other Scripting Engines +Programming Language :: Pascal +Programming Language :: Perl +Programming Language :: PHP +Programming Language :: Pike +Programming Language :: Pliant +Programming Language :: PL/SQL +Programming Language :: PROGRESS +Programming Language :: Prolog +Programming Language :: Python +Programming Language :: REBOL +Programming Language :: Rexx +Programming Language :: Ruby +Programming Language :: Scheme +Programming Language :: Simula +Programming Language :: Smalltalk +Programming Language :: SQL +Programming Language :: Tcl +Programming Language :: Unix Shell +Programming Language :: Visual Basic +Programming Language :: XBasic +Programming Language :: YACC +Programming Language :: Zope +Topic :: Adaptive Technologies +Topic :: Artistic Software +Topic :: Communications +Topic :: Communications :: BBS +Topic :: Communications :: Chat +Topic :: Communications :: Chat :: AOL Instant Messenger +Topic :: Communications :: Chat :: ICQ +Topic :: Communications :: Chat :: Internet Relay Chat +Topic :: Communications :: Chat :: Unix Talk +Topic :: Communications :: Conferencing +Topic :: Communications :: Email +Topic :: Communications :: Email :: Address Book +Topic :: Communications :: Email :: Email Clients (MUA) +Topic :: Communications :: Email :: Filters +Topic :: Communications :: Email :: Mailing List Servers +Topic :: Communications :: Email :: Mail Transport Agents +Topic :: Communications :: Email :: Post-Office +Topic :: Communications :: Email :: Post-Office :: IMAP +Topic :: Communications :: Email :: Post-Office :: POP3 +Topic :: Communications :: Fax +Topic :: Communications :: FIDO +Topic :: Communications :: File Sharing +Topic :: Communications :: File Sharing :: Gnutella +Topic :: Communications :: File Sharing :: Napster +Topic :: Communications :: Ham Radio +Topic :: Communications :: Internet Phone +Topic :: Communications :: Telephony +Topic :: Communications :: Usenet News +Topic :: Database +Topic :: Database :: Database Engines/Servers +Topic :: Database :: Front-Ends +Topic :: Desktop Environment +Topic :: Desktop Environment :: File Managers +Topic :: Desktop Environment :: Gnome +Topic :: Desktop Environment :: GNUstep +Topic :: Desktop Environment :: K Desktop Environment (KDE) +Topic :: Desktop Environment :: K Desktop Environment (KDE) :: Themes +Topic :: Desktop Environment :: PicoGUI +Topic :: Desktop Environment :: PicoGUI :: Applications +Topic :: Desktop Environment :: PicoGUI :: Themes +Topic :: Desktop Environment :: Screen Savers +Topic :: Desktop Environment :: Window Managers +Topic :: Desktop Environment :: Window Managers :: Afterstep +Topic :: Desktop Environment :: Window Managers :: Afterstep :: Themes +Topic :: Desktop Environment :: Window Managers :: Applets +Topic :: Desktop Environment :: Window Managers :: Blackbox +Topic :: Desktop Environment :: Window Managers :: Blackbox :: Themes +Topic :: Desktop Environment :: Window Managers :: CTWM +Topic :: Desktop Environment :: Window Managers :: CTWM :: Themes +Topic :: Desktop Environment :: Window Managers :: Enlightenment +Topic :: Desktop Environment :: Window Managers :: Enlightenment :: Epplets +Topic :: Desktop Environment :: Window Managers :: Enlightenment :: Themes DR15 +Topic :: Desktop Environment :: Window Managers :: Enlightenment :: Themes DR16 +Topic :: Desktop Environment :: Window Managers :: Enlightenment :: Themes DR17 +Topic :: Desktop Environment :: Window Managers :: Fluxbox +Topic :: Desktop Environment :: Window Managers :: Fluxbox :: Themes +Topic :: Desktop Environment :: Window Managers :: FVWM +Topic :: Desktop Environment :: Window Managers :: FVWM :: Themes +Topic :: Desktop Environment :: Window Managers :: IceWM +Topic :: Desktop Environment :: Window Managers :: IceWM :: Themes +Topic :: Desktop Environment :: Window Managers :: MetaCity +Topic :: Desktop Environment :: Window Managers :: MetaCity :: Themes +Topic :: Desktop Environment :: Window Managers :: Oroborus +Topic :: Desktop Environment :: Window Managers :: Oroborus :: Themes +Topic :: Desktop Environment :: Window Managers :: Sawfish +Topic :: Desktop Environment :: Window Managers :: Sawfish :: Themes 0.30 +Topic :: Desktop Environment :: Window Managers :: Sawfish :: Themes pre-0.30 +Topic :: Desktop Environment :: Window Managers :: Waimea +Topic :: Desktop Environment :: Window Managers :: Waimea :: Themes +Topic :: Desktop Environment :: Window Managers :: Window Maker +Topic :: Desktop Environment :: Window Managers :: Window Maker :: Applets +Topic :: Desktop Environment :: Window Managers :: Window Maker :: Themes +Topic :: Desktop Environment :: Window Managers :: XFCE +Topic :: Desktop Environment :: Window Managers :: XFCE :: Themes +Topic :: Documentation +Topic :: Education +Topic :: Education :: Computer Aided Instruction (CAI) +Topic :: Education :: Testing +Topic :: Games/Entertainment +Topic :: Games/Entertainment :: Arcade +Topic :: Games/Entertainment :: Board Games +Topic :: Games/Entertainment :: First Person Shooters +Topic :: Games/Entertainment :: Fortune Cookies +Topic :: Games/Entertainment :: Multi-User Dungeons (MUD) +Topic :: Games/Entertainment :: Puzzle Games +Topic :: Games/Entertainment :: Real Time Strategy +Topic :: Games/Entertainment :: Role-Playing +Topic :: Games/Entertainment :: Side-Scrolling/Arcade Games +Topic :: Games/Entertainment :: Simulation +Topic :: Games/Entertainment :: Turn Based Strategy +Topic :: Home Automation +Topic :: Internet +Topic :: Internet :: File Transfer Protocol (FTP) +Topic :: Internet :: Finger +Topic :: Internet :: Log Analysis +Topic :: Internet :: Name Service (DNS) +Topic :: Internet :: Proxy Servers +Topic :: Internet :: WAP +Topic :: Internet :: WWW/HTTP +Topic :: Internet :: WWW/HTTP :: Browsers +Topic :: Internet :: WWW/HTTP :: Dynamic Content +Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries +Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Message Boards +Topic :: Internet :: WWW/HTTP :: Dynamic Content :: News/Diary +Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Page Counters +Topic :: Internet :: WWW/HTTP :: HTTP Servers +Topic :: Internet :: WWW/HTTP :: Indexing/Search +Topic :: Internet :: WWW/HTTP :: Site Management +Topic :: Internet :: WWW/HTTP :: Site Management :: Link Checking +Topic :: Internet :: Z39.50 +Topic :: Multimedia +Topic :: Multimedia :: Graphics +Topic :: Multimedia :: Graphics :: 3D Modeling +Topic :: Multimedia :: Graphics :: 3D Rendering +Topic :: Multimedia :: Graphics :: Capture +Topic :: Multimedia :: Graphics :: Capture :: Digital Camera +Topic :: Multimedia :: Graphics :: Capture :: Scanners +Topic :: Multimedia :: Graphics :: Capture :: Screen Capture +Topic :: Multimedia :: Graphics :: Editors +Topic :: Multimedia :: Graphics :: Editors :: Raster-Based +Topic :: Multimedia :: Graphics :: Editors :: Vector-Based +Topic :: Multimedia :: Graphics :: Graphics Conversion +Topic :: Multimedia :: Graphics :: Presentation +Topic :: Multimedia :: Graphics :: Viewers +Topic :: Multimedia :: Sound/Audio +Topic :: Multimedia :: Sound/Audio :: Analysis +Topic :: Multimedia :: Sound/Audio :: Capture/Recording +Topic :: Multimedia :: Sound/Audio :: CD Audio +Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Playing +Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping +Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Writing +Topic :: Multimedia :: Sound/Audio :: Conversion +Topic :: Multimedia :: Sound/Audio :: Editors +Topic :: Multimedia :: Sound/Audio :: MIDI +Topic :: Multimedia :: Sound/Audio :: Mixers +Topic :: Multimedia :: Sound/Audio :: Players +Topic :: Multimedia :: Sound/Audio :: Players :: MP3 +Topic :: Multimedia :: Sound/Audio :: Sound Synthesis +Topic :: Multimedia :: Sound/Audio :: Speech +Topic :: Multimedia :: Video +Topic :: Multimedia :: Video :: Capture +Topic :: Multimedia :: Video :: Conversion +Topic :: Multimedia :: Video :: Display +Topic :: Multimedia :: Video :: Non-Linear Editor +Topic :: Office/Business +Topic :: Office/Business :: Financial +Topic :: Office/Business :: Financial :: Accounting +Topic :: Office/Business :: Financial :: Investment +Topic :: Office/Business :: Financial :: Point-Of-Sale +Topic :: Office/Business :: Financial :: Spreadsheet +Topic :: Office/Business :: Groupware +Topic :: Office/Business :: News/Diary +Topic :: Office/Business :: Office Suites +Topic :: Office/Business :: Scheduling +Topic :: Other/Nonlisted Topic +Topic :: Printing +Topic :: Religion +Topic :: Scientific/Engineering +Topic :: Scientific/Engineering :: Artificial Intelligence +Topic :: Scientific/Engineering :: Astronomy +Topic :: Scientific/Engineering :: Bio-Informatics +Topic :: Scientific/Engineering :: Chemistry +Topic :: Scientific/Engineering :: Electronic Design Automation (EDA) +Topic :: Scientific/Engineering :: GIS +Topic :: Scientific/Engineering :: Human Machine Interfaces +Topic :: Scientific/Engineering :: Image Recognition +Topic :: Scientific/Engineering :: Information Analysis +Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator +Topic :: Scientific/Engineering :: Mathematics +Topic :: Scientific/Engineering :: Medical Science Apps. +Topic :: Scientific/Engineering :: Physics +Topic :: Scientific/Engineering :: Visualization +Topic :: Security +Topic :: Security :: Cryptography +Topic :: Sociology +Topic :: Sociology :: Genealogy +Topic :: Sociology :: History +Topic :: Software Development +Topic :: Software Development :: Assemblers +Topic :: Software Development :: Bug Tracking +Topic :: Software Development :: Build Tools +Topic :: Software Development :: Code Generators +Topic :: Software Development :: Compilers +Topic :: Software Development :: Debuggers +Topic :: Software Development :: Disassemblers +Topic :: Software Development :: Documentation +Topic :: Software Development :: Embedded Systems +Topic :: Software Development :: Internationalization +Topic :: Software Development :: Interpreters +Topic :: Software Development :: Libraries +Topic :: Software Development :: Libraries :: Application Frameworks +Topic :: Software Development :: Libraries :: Java Libraries +Topic :: Software Development :: Libraries :: Perl Modules +Topic :: Software Development :: Libraries :: PHP Classes +Topic :: Software Development :: Libraries :: Pike Modules +Topic :: Software Development :: Libraries :: Python Modules +Topic :: Software Development :: Libraries :: Ruby Modules +Topic :: Software Development :: Libraries :: Tcl Extensions +Topic :: Software Development :: Localization +Topic :: Software Development :: Object Brokering +Topic :: Software Development :: Object Brokering :: CORBA +Topic :: Software Development :: Pre-processors +Topic :: Software Development :: Quality Assurance +Topic :: Software Development :: Testing +Topic :: Software Development :: Testing :: Traffic Generation +Topic :: Software Development :: User Interfaces +Topic :: Software Development :: Version Control +Topic :: Software Development :: Version Control :: CVS +Topic :: Software Development :: Version Control :: RCS +Topic :: Software Development :: Version Control :: SCCS +Topic :: Software Development :: Widget Sets +Topic :: System +Topic :: System :: Archiving +Topic :: System :: Archiving :: Backup +Topic :: System :: Archiving :: Compression +Topic :: System :: Archiving :: Mirroring +Topic :: System :: Archiving :: Packaging +Topic :: System :: Benchmark +Topic :: System :: Boot +Topic :: System :: Boot :: Init +Topic :: System :: Clustering +Topic :: System :: Console Fonts +Topic :: System :: Distributed Computing +Topic :: System :: Emulators +Topic :: System :: Filesystems +Topic :: System :: Hardware +Topic :: System :: Hardware :: Hardware Drivers +Topic :: System :: Hardware :: Mainframes +Topic :: System :: Hardware :: Symmetric Multi-processing +Topic :: System :: Installation/Setup +Topic :: System :: Logging +Topic :: System :: Monitoring +Topic :: System :: Networking +Topic :: System :: Networking :: Firewalls +Topic :: System :: Networking :: Monitoring +Topic :: System :: Networking :: Monitoring :: Hardware Watchdog +Topic :: System :: Networking :: Time Synchronization +Topic :: System :: Operating System +Topic :: System :: Operating System Kernels +Topic :: System :: Operating System Kernels :: BSD +Topic :: System :: Operating System Kernels :: GNU Hurd +Topic :: System :: Operating System Kernels :: Linux +Topic :: System :: Power (UPS) +Topic :: System :: Recovery Tools +Topic :: System :: Shells +Topic :: System :: Software Distribution +Topic :: System :: Systems Administration +Topic :: System :: Systems Administration :: Authentication/Directory +Topic :: System :: Systems Administration :: Authentication/Directory :: LDAP +Topic :: System :: Systems Administration :: Authentication/Directory :: NIS +Topic :: System :: System Shells +Topic :: Terminals +Topic :: Terminals :: Serial +Topic :: Terminals :: Telnet +Topic :: Terminals :: Terminal Emulators/X Terminals +Topic :: Text Editors +Topic :: Text Editors :: Documentation +Topic :: Text Editors :: Emacs +Topic :: Text Editors :: Integrated Development Environments (IDE) +Topic :: Text Editors :: Text Processing +Topic :: Text Editors :: Word Processors +Topic :: Text Processing +Topic :: Text Processing :: Filters +Topic :: Text Processing :: Fonts +Topic :: Text Processing :: General +Topic :: Text Processing :: Indexing +Topic :: Text Processing :: Linguistic +Topic :: Text Processing :: Markup +Topic :: Text Processing :: Markup :: HTML +Topic :: Text Processing :: Markup :: LaTeX +Topic :: Text Processing :: Markup :: SGML +Topic :: Text Processing :: Markup :: VRML +Topic :: Text Processing :: Markup :: XML +Topic :: Utilities diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/config.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/config.py new file mode 100644 index 0000000..357f0e1 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/config.py @@ -0,0 +1,58 @@ +""" +$Id: config.py 116964 2010-05-05 23:26:09Z kteague $ +""" +from zLOG import LOG, PROBLEM +import os +from App.Common import package_home +from trove import TroveClassifier + + +# Use ExternalStorage for LECFile? +USE_EXTERNAL_STORAGE = True + +# Change to point to where content should be stored, it can be an +# absolute or a relative path. +# A relative path is based on '$INSTANCE_HOME/var' directory (the +# Data.fs dir) or, if present, on ENVIRONMENT_VARIABLE defined by +# the ExternalStorage config (default: EXTERNAL_STORAGE_BASE_PATH) +EXTERNAL_STORAGE_PATH = 'files' + +PROJECTNAME = 'LibExtensionCenter' +SKINS_DIR = 'skins' + +HARD_DEPS = ('AddRemoveWidget', 'ArchAddOn', 'DataGridField',) +SOFT_DEPS = 'ATReferenceBrowserWidget', + +RELEASES_ID = 'releases' +IMPROVEMENTS_ID = 'roadmap' +DOCUMENTATION_ID = 'documentation' +TRACKER_ID = 'issues' + +TEXT_TYPES = ( + 'text/structured', + 'text/x-rst', + 'text/html', + 'text/plain', +) + +IMAGE_SIZES = { + 'preview': (256, 256), + 'thumb': (128, 128), + 'tile': (64, 64), + 'icon': (32, 32), + 'listing': (16, 16), +} + +GLOBALS = globals() + +if USE_EXTERNAL_STORAGE: + try: + import Products.ExternalStorage + except ImportError: + LOG('LiboExtensionCenter', + PROBLEM, 'ExternalStorage N/A, falling back to AttributeStorage') + USE_EXTERNAL_STORAGE = False + +trove_default = os.path.join(package_home(GLOBALS), 'TROVE.txt') +trove = TroveClassifier(trove_default) + diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/config.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/config.pyc Binary files differnew file mode 100644 index 0000000..2a101b8 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/config.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/interfaces.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/interfaces.py new file mode 100644 index 0000000..669fce1 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/interfaces.py @@ -0,0 +1,38 @@ +from zope.interface import Interface + +class IExtensionCenterContent(Interface): + """The root extesnsioncenter + """ + +class IProjectContent(Interface): + """A project in the extension center + """ + +class IDocumentationFolderContent(Interface): + """A folder for documentation + """ + +class IImprovementProposalFolderContent(Interface): + """A folder for improvement proposals + """ + +class IImprovementProposalContent(Interface): + """An improvement proposal + """ + +class IReleaseFolderContent(Interface): + """A folder for releases + """ + +class IReleaseContent(Interface): + """A release in a project + """ + +class IFileContent(Interface): + """A downloadable file + """ + +class IFileLinkContent(Interface): + """A link to a downloadable file + """ + diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/interfaces.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/interfaces.pyc Binary files differnew file mode 100644 index 0000000..51dd0b8 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/interfaces.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/permissions.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/permissions.py new file mode 100644 index 0000000..5b9b337 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/permissions.py @@ -0,0 +1,19 @@ +""" +$Id: permissions.py 65992 2008-06-01 00:40:45Z rossp $ +""" +from Products.CMFCore.permissions import setDefaultRoles + +AddExtensionCenter = "LiboExtensionCenter: Add Extension Center" +AddProject = 'LiboExtensionCenter: Add Project' +AddReviewComment = 'LiboExtension: Add Review Comment' +ApproveProject = 'LiboExtensionCenter: Approve Project' + +# Let members add new projects, but only manager add help centres +setDefaultRoles(AddExtensionCenter, ('Manager',)) + +# Setting this by default and controlling with area workflow means factory +# works +setDefaultRoles(AddProject, ('Manager','Owner',)) + +setDefaultRoles(AddReviewComment, ('Manager', 'LECEvaluator',)) +setDefaultRoles(ApproveProject, ('Manager', 'LECEvaluator',)) diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/permissions.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/permissions.pyc Binary files differnew file mode 100644 index 0000000..3456b7f --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/permissions.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/pypi.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/pypi.py new file mode 100644 index 0000000..57be736 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/pypi.py @@ -0,0 +1,71 @@ +"""utils to fetch download counts from PyPI""" + +from collections import deque, defaultdict +import logging +import transaction +import xmlrpclib +from Products.CMFCore.utils import getToolByName + +logger = logging.getLogger('am.LiboExtensionCenter') + +client = xmlrpclib.ServerProxy('http://pypi.python.org/pypi') + +def by_two(source): + out = [] + for x in source: + out.append(x) + if len(out) == 2: + yield out + out = [] + +def package_releases(packages): + mcall = xmlrpclib.MultiCall(client) + called_packages = deque() + for package in packages: + mcall.package_releases(package,True) + called_packages.append(package) + if len(called_packages) == 100: + result = mcall() + mcall = xmlrpclib.MultiCall(client) + for releases in result: + yield called_packages.popleft(), releases + result = mcall() + for releases in result: + yield called_packages.popleft(), releases + +def release_data(packages): + mcall = xmlrpclib.MultiCall(client) + i = 0 + for package, releases in package_releases(packages): + for version in releases: + mcall.release_urls(package, version) + mcall.release_data(package, version) + i += 1 + if i % 50 == 49: + result = mcall() + mcall = xmlrpclib.MultiCall(client) + for urls, data in by_two(result): + yield urls, data + result = mcall() + for urls, data in by_two(result): + yield urls, data + +def update_package_download_counts(context): + logger.info('Updating download counts from PyPI') + + app = context.getPhysicalRoot() + catalog = getToolByName(context, 'portal_catalog') + package_ids = catalog.uniqueValuesFor('getDistutilsMainId') + counts = defaultdict(lambda: 0) + for urls, data in release_data(package_ids): + downloads = 0 + for url in urls: + downloads += url['downloads'] + counts[data.get('name')] += downloads + + for package_id, downloads in counts.items(): + brain = catalog.unrestrictedSearchResults(getDistutilsMainId=package_id)[0] + package = app.unrestrictedTraverse(brain.getPath()) + if package.getDownloadCount() != -1: + package.setDownloadCount(downloads) + transaction.commit() diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/pypi.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/pypi.pyc Binary files differnew file mode 100644 index 0000000..0a3c4f5 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/pypi.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/setuphandlers.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/setuphandlers.py new file mode 100644 index 0000000..ea6f6a7 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/setuphandlers.py @@ -0,0 +1,446 @@ +""" +contains handlers for GS +""" +import xmlrpclib +import tempfile +import os +import shutil +import logging +import tarfile +import zipfile +import re +import sys +import subprocess +import urllib2 +import socket +import transaction + +from StringIO import StringIO +from OFS.Image import File + +from zExceptions import Unauthorized +from Products.Archetypes.atapi import * +from Products.CMFCore.utils import getToolByName +from am.LiboExtensionCenter import config +from am.LiboExtensionCenter.content.downloadablefile import LECFile, LECFileSchema +from ZODB.POSException import ConflictError + +NAME = re.compile('Name: (.*)') + +# if your previous instance had +WAS_EXTERNAL_STORAGE = True +EXTERNAL_STORAGE_PATHS = ('/srv/plone.org/zope/files/', + '/srv/plone.org/buildout/parts/instance01/var/files/', + '/srv/plone.org/buildout/parts/instance02/var/files/', + '/srv/plone.org/buildout/parts/instance03/var/files/', + '/srv/plone.org/buildout/parts/instance04/var/files/') + +def temp(function): + def _temp(*args, **kw): + working_dir = tempfile.mkdtemp() + old_location = os.getcwd() + os.chdir(working_dir) + try: + return function(*args, **kw) + finally: + os.chdir(old_location) + shutil.rmtree(working_dir, ignore_errors=True) + return _temp + +def timeout(function): + def _timeout(*args, **kw): + old = socket.getdefaulttimeout() + socket.setdefaulttimeout(4) + try: + return function(*args, **kw) + finally: + socket.setdefaulttimeout(old) + return _timeout + +class DistantFile(object): + def __init__(self, url): + try: + self.handle = urllib2.urlopen(url) + except (urllib2.HTTPError, urllib2.URLError): + self.handle = None + self.url = url + self.on_pypi = url.startswith('http://pypi.python.org') + + def getDownloadableFile(self): + return self + + def getId(self): + url = self.url.split('#md5=') + url = url[0] + return url.split()[-1] + + def get_data(self): + if self.handle is None: + return "" + return self.handle.read() + +@timeout +def before_1_5(portal_setup): + """runs a migration on a previous version of LEC + + before the product switched to migration.xml + """ + def _upgrade_project(project): + + #main = StringField('distutilsMainId', + # required=0, + # schemata="distutils", + # index='KeywordIndex:schema', + # ) + #project.schema['distutilsMainId'] = main + + #sec = LinesField('distutilsSecondaryIds', + # multiValued=1, + # required=0, + # schemata="distutils", + # index='KeywordIndex:schema') + #project.schema['distutilsSecondaryIds'] = sec + pass + + def _upgrade_lec(lec): + logging.info('Upgrading %s' % lec.title_or_id()) + # we might want to do something else here + #strategy = StringField('storageStrategy', + # default='archetype', + # vocabulary='getFileStorageStrategyVocab', + #) + + #lec.schema['storageStrategy'] = strategy + + def _discovering_dist_ids(project): + # for each file in the project we + # extract the distutils name + project_path = '/'.join(project.getPhysicalPath()) + files = cat(**{'portal_type': ['LECFile', 'LECFileLink'], + 'path': project_path}) + ids = [] + for file_ in files: + portal_type = file_.portal_type + if portal_type == 'LECFileLink': + # the file is somewhere else, let's scan it + file_ = file_.getObject() + file_ = DistantFile(file_.getExternalURL()) + else: + file_ = file_.getObject() + + # trying to get back from old + # storage + + # ExternalStorage here + # + if WAS_EXTERNAL_STORAGE and portal_type != 'LECFileLink': + from Products.ExternalStorage.ExternalStorage import ExternalStorage + storage = ExternalStorage( + prefix=EXTERNAL_STORAGE_PATHS[0], + archive=False, + rename=False, + ) + # transferring old data to new AT container + fs = file_.schema['downloadableFile'] + old = fs.storage + fs.storage = storage + portal_url = getToolByName(file_, 'portal_url') + + real_file = os.path.join(*portal_url.getRelativeContentPath(file_)) + for path in EXTERNAL_STORAGE_PATHS: + final_file = os.path.join(path, real_file) + if os.path.exists(final_file): + break + if not os.path.exists(final_file): + logging.info('******** could not get %s on the file system !!' % real_file) + continue + #raise ValueError('File not found %s' % final_file) + fs.storage = old + dfile = file_.getDownloadableFile() + + filename = dfile.filename + data = open(final_file).read() + if data == '': + logging.info('empty file ! %s' % final_file) + #f = File(filename, filename, open(final_file)) + + elif portal_type != 'LECFileLink': + storage = AttributeStorage() + fs = file_.schema['downloadableFile'] + old = fs.storage + fs.storage = storage + dfile = file_.getDownloadableFile() + data = dfile.get_data() + filename = dfile.filename + fs.storage = old + #file_.getDownloadableFile().data = data + #f = File(filename, filename, StringIO(data)) + + if portal_type != 'LECFileLink': + #file_.setDownloadableFile(f) + file_.schema = LECFileSchema + if filename == '' and data == '': + logging.info('file empty for %s' % file_) + else: + if filename is None: + filename = file_.getId() + file_.setDownloadableFile(File(filename, filename, StringIO(data))) + id_ = extract_distutils_id(file_) + if id_ is not None and id_ not in ids: + ids.append(id_) + return ids + + # XXX see what to do with earlier versions than + # < 1.5 + cat = getToolByName(portal_setup, 'portal_catalog') + + # getting all LEC instances + lecs = cat(**{'portal_type': 'LiboExtensionCenter'}) + + # checking all LiboExtensionCenter instances + for lec in leccs: + lec = lec.getObject() + + _upgrade_lec(lec) + # for each instance we want to + # synchronize distutils ids + distutils_ids = {} + for project in lec.objectValues(): + if project.getId() in ('plone',): + logging.info('Skipping %s' % project.getId()) + continue + logging.info('Working on %s' % project.getId()) + _upgrade_project(project) + + # trying to find distutils ids + ids = _discovering_dist_ids(project) + + for id_ in ids: + old = distutils_ids.get(id_, ()) + if project in old: + continue + distutils_ids[id_] = old + (project,) + + # synchronize with the Cheeseshop + logging.info('Starting synchro') + pypi_synchro(distutils_ids) + +@temp +def extract_distutils_id(egg_or_tarball): + """gives the disutils id""" + file_ = egg_or_tarball.getDownloadableFile() + filename = egg_or_tarball.getId() + try: + data = file_.get_data() + except socket.timeout: + data = '' + + if data == '': + logging.info('Could not get the file for %s' % filename) + return None + + fileobj = StringIO(data) + # is it a tarfile (let's trust the extension) + if (filename.split('.')[-2:] == ['tar', 'gz'] or + filename.split('.')[-1] == 'tgz'): + # Python 2.4's tarfile should be too buggy + # to extract setup.py + try: + tar = tarfile.TarFile.open(filename, fileobj=fileobj, mode='r:gz') + except tarfile.ReadError: + return None + first_member = tar.getnames()[0] + folder = os.path.split(first_member)[0] + for tarinfo in tar: + try: + tar.extract(tarinfo) + except TypeError: + pass + tar.close() + # let's get into the extracted package + old = os.getcwd() + folder = os.path.join(old, folder) + if 'setup.py' not in os.listdir(folder): + # we are probably one level too high + folder = os.path.join(folder, first_member) + try: + os.chdir(folder) + except TypeError: + return None + # if the file does not have a setup.py, let's quit + if 'setup.py' not in os.listdir(folder): + return None + try: + name = subprocess.Popen([sys.executable, 'setup.py', '--name'], + stdout=subprocess.PIPE).communicate()[0] + finally: + os.chdir(old) + + logging.info('Found a distutils name : %s' % str(name)) + return name.strip() + # its an egg (a zip) + elif os.path.splitext(filename)[-1] == '.egg': + zip = zipfile.ZipFile(fileobj, 'r') + try: + for info in zip.infolist(): + if info.filename != 'EGG-INFO/PKG-INFO': + continue + res = NAME.search(zip.read(info.filename)) + if res is not None and len(res.groups()) == 1: + logging.info('Found a distutils name : %s' % str(res.groups()[0])) + return res.groups()[0] + finally: + zip.close() + + # its something we don't want to deal with + return None + +def _attribute_distid(project, distid): + try: + if not project.getDistutilsMainId(): + logging.info('%s owns %s (main id)' % (project.getId(), distid)) + project.setDistutilsMainId(distid) + else: + logging.info('%s owns %s (secondary id)' % (project.getId(), distid)) + project.setDistutilsSecondaryIds(distid) + project.reindexObject() + logging.info('%s owns %s' % (project.getId(), distid)) + except Unauthorized: + logging.info('%s is already owned, cannot give it to %s' % \ + (project.getId(), distid)) + +tiny_cache = {} + +def _pypi_certified_owner(distid): + if distid in tiny_cache: + return tiny_cache[distid] + logging.info('asking PyPI for contact for %s' % distid) + pypi = xmlrpclib.ServerProxy('http://python.org/pypi') + versions = pypi.package_releases(distid) + if versions == []: + return None, None + version = versions[-1] + data = pypi.release_data(distid, version) + maintainer = data['maintainer_email'] + author = data['author_email'] + return maintainer, author + +def pypi_synchro(distutils_ids): + """for each id, we want to check a few infos + one PyPI to try to match the package""" + # let's check on PyPI for the given id, who is the email contact + for distid, projects in distutils_ids.items(): + pypi_owners = _pypi_certified_owner(distid) + if pypi_owners is (None, None): + # there are no such package at PypI. + # we can use that id here + # we give it to the first one + # + # XXX what happens if someone else + # registers at PyPI later ? + # we get out of sync, but this is quite + # unavoidable: LEC doesn't act as a pypi mirror + p = projects[0] + _attribute_distid(p, distid) + for p2 in projects[1:]: + logging.warning('%s conflicts with %s' % \ + (p2.getId(), p.getId())) + # (author_email, id) is unique at PyPI + for i, project in enumerate(projects): + author_email = project.getContactAddress() + if author_email.startswith('mailto:'): + # get ridd of that crappy header + author_email = author_email[len('mailto:'):] + if author_email in pypi_owners: + # found ! + _attribute_distid(project, distid) + for p in projects[i+1:]: + logging.warning('%s conflicts with %s' % \ + (p2.getId(), project.getId())) + break + +# XXX I'm not really sure what is going on here (above ^^^), does all this +# get run every time the profile is imported? + +# Rip off SteveM's PHC catalog index import stuff +def install(self): + out = StringIO() + + # Add catalog metadata columns and indexes + catalog = getToolByName(self, 'portal_catalog') + addCatalogIndex(self, out, catalog, 'getCategories', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getCategories') + addCatalogIndex(self, out, catalog, 'getClassifiers', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getClassifiers') + addCatalogIndex(self, out, catalog, 'getCategoryTitles', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getCategoryTitles') + addCatalogIndex(self, out, catalog, 'getCompatibility', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getCompatibility') + addCatalogIndex(self, out, catalog, 'getProposalTypes', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getProposalTypes') + addCatalogIndex(self, out, catalog, 'getProposer', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getProposer') + addCatalogIndex(self, out, catalog, 'getRelatedReleases', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getRelatedReleases') + addCatalogIndex(self, out, catalog, 'getSeconder', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getSeconder') + addCatalogIndex(self, out, catalog, 'getSelfCertifiedCriteria', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getSelfCertifiedCriteria') + addCatalogIndex(self, out, catalog, 'releaseCount', 'FieldIndex') + addCatalogMetadata(self, out, catalog, 'releaseCount') + addCatalogIndex(self, out, catalog, 'getDistutilsMainId', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getDistutilsMainId') + addCatalogIndex(self, out, catalog, 'getDistutilsSecondaryIds', 'KeywordIndex') + addCatalogMetadata(self, out, catalog, 'getDistutilsSecondaryIds') + addCatalogIndex(self, out, catalog, 'getDownloadCount', 'FieldIndex') + addCatalogIndex(self, out, catalog, 'getLatestReleaseDate', 'DateIndex') + addCatalogMetadata(self, out, catalog, 'getLatestReleaseDate') + + print >> out, "Added LEC items to catalog indexes and metadata" + + setupCioppinoTwoThumbs(self, out) + +def addCatalogIndex(self, out, catalog, index, type, extra = None): + """Add the given index name, of the given type, to the catalog.""" + + if index not in catalog.indexes(): + catalog.addIndex(index, type, extra) + print >> out, "Added index", index, "to catalog" + else: + print >> out, "Index", index, "already in catalog" + +def addCatalogMetadata(self, out, catalog, column): + """Add the given column to the catalog's metadata schema""" + + if column not in catalog.schema(): + catalog.addColumn(column) + print >> out, "Added", column, "to catalog metadata" + else: + print >> out, column, "already in catalog metadata" + + +def setupCioppinoTwoThumbs(self, out): + """ + Install the twothumbs product and reindex its indexes + """ + # I am getting weird errors putting this in metadata.xml + # I think it has something to do with custome profile stuff + # in extensions/install.py + qi = getToolByName(self, 'portal_quickinstaller') + if not qi.isProductInstalled('cioppino.twothumbs'): + qi.installProduct('cioppino.twothumbs',) + print >> out, "Installed cioppino.twothumbs" + + +def importVarious(context): + """ + Final liboextensioncenter import steps. + """ + + # Only run step if a flag file is present (e.g. not an extension profile) + if context.readDataFile('liboextensioncenter-various.txt') is None: + return + + site = context.getSite() + print install(site) + diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/setuphandlers.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/setuphandlers.pyc Binary files differnew file mode 100644 index 0000000..7ce3182 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/setuphandlers.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/trove.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/trove.py new file mode 100644 index 0000000..669dc89 --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/trove.py @@ -0,0 +1,66 @@ +""" +Trove reader +$Id: trove.py 59742 2008-02-29 16:24:43Z aclark $ +""" +from urllib2 import urlopen +from urllib2 import URLError +import socket +from itertools import groupby + +PYPI_CLASSIFIERS_URL = 'http://pypi.python.org/pypi?%3Aaction=list_classifiers' + +class TroveClassifier(object): + """LiboExtension-friendly Trove provider + """ + + def __init__(self, default=None): + self.default = default + try: + old_timeout = socket.getdefaulttimeout() + socket.setdefaulttimeout(10) + try: + trove = urlopen(PYPI_CLASSIFIERS_URL) + finally: + socket.setdefaulttimeout(old_timeout) + except URLError: # no web connection + # if it has failed, we will use the saved one + trove = open(self.default) + try: + self._data = sorted([line.strip() for line in + trove.readlines()]) + finally: + trove.close() + self._build() + + def _make_id(self, field): + """Make id.""" + return field.lower().replace(' ', ''), field + + def _build(self): + """Builds unique ids.""" + ids = {} + for line in self._data: + split = line.split(' :: ') + i = -1 + id_, title = self._make_id(split[i]) + while id_ in ids: + i -= 1 + id_ = '%s %s' % (split[i], id_) + id_, title = self._make_id(id_) + ids[line] = id_, title + self._ids = ids + + def get(self): + """Returns data.""" + return self._data + + def get_datagrid(self): + """Returns a datagrid-like structure.""" + def _sorted(key1, key2): + key1 = key1.split('|')[-1] + key2 = key2.split('|')[-1] + return cmp(key1, key2) + + return sorted(['%s|%s|%s' % (value[0], value[1], key) + for key, value in self._ids.items()], _sorted) + diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/trove.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/trove.pyc Binary files differnew file mode 100644 index 0000000..4b8282d --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/trove.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/utils.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/utils.py new file mode 100644 index 0000000..2eb126f --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/utils.py @@ -0,0 +1,209 @@ +""" +Contains utility functions + +$Id: utils.py 66278 2008-06-06 12:34:06Z tarek $ +""" +import os +import re +import zipfile +import StringIO +import operator +import distutils.version +from itertools import chain + +from Products.CMFCore.utils import getToolByName + +re_validPackage = re.compile(r"(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)") +# (package) (rest) + +re_paren = re.compile(r"^\s*\((.*)\)\s*$") # (list) inside of parentheses +re_splitComparison = re.compile(r"^\s*(<=|>=|<|>|!=|==)\s*([^\s,]+)\s*$") +# (comp) (version) + + +safe_zipnames = re.compile(r'(purelib|platlib|headers|scripts|data).+', re.I) + +def plat(name): + generic = r'^[\w\-\.]+\.%s\-[\w\-\.]+\.tar\.gz$' + return re.compile(generic % name, re.I) + +platform_catchers = ((plat('macosx'), 'Mac OS X'), + (plat('linux'), 'Linux'), + (plat('win32'), 'Windows')) + +def which_platform(filename_or_url): + """Get the platform with the filename. + + - an egg will be considered as non-specific to a platform + even if it contains a specific compilation + - a tar.gz name will be scanned + """ + if '/' in filename_or_url: + filename = filename_or_url.split('/')[-1] + else: + filename = filename_or_url + + for catcher, platform in platform_catchers: + if catcher.search(filename) is not None: + return platform + return 'All platforms' + +def is_distutils_file(content, filename, filetype): + """Perform some basic checks to see whether the indicated file could be + a valid distutils file. + """ + if filename.endswith('.exe'): + # check for valid exe + if filetype != 'bdist_wininst': + return False + + try: + t = StringIO.StringIO(content) + t.filename = filename + z = zipfile.ZipFile(t) + l = z.namelist() + except zipfile.error: + return False + + for zipname in l: + if not safe_zipnames.match(zipname): + return False + + elif filename.endswith('.zip'): + # check for valid zip + try: + t = StringIO.StringIO(content) + t.filename = filename + z = zipfile.ZipFile(t) + l = z.namelist() + except zipfile.error: + return False + for entry in l: + parts = os.path.split(entry) + if len(parts) == 2 and parts[1] == 'PKG-INFO': + # eg. "roundup-0.8.2/PKG-INFO" + break + else: + return False + + return True + +def splitUp(pred): + """Parse a single version comparison. + Return (comparison string, StrictVersion) + """ + res = re_splitComparison.match(pred) + if not res: + raise ValueError, "Bad package restriction syntax: " + pred + comp, verStr = res.groups() + return (comp, distutils.version.StrictVersion(verStr)) + +compmap = {"<": operator.lt, "<=": operator.le, "==": operator.eq, + ">": operator.gt, ">=": operator.ge, "!=": operator.ne} + +class VersionPredicate: + """Parse and test package version predicates. + + >>> v = VersionPredicate("pyepat.abc (>1.0, <3333.3a1, !=1555.1b3, !=1.2.3)") + >>> print v + pyepat.abc (> 1.0, < 3333.3a1, != 1555.1b3, != 1.2.3) + >>> v.satisfied_by("1.1") + True + >>> v.satisfied_by("1.4") + True + >>> v.satisfied_by("1.0") + False + >>> v.satisfied_by("4444.4") + False + >>> v.satisfied_by("1555.1b3") + False + >>> v = VersionPredicate("pat( == 0.1 ) ") + >>> v.satisfied_by("0.1") + True + >>> v.satisfied_by("0.2") + False + >>> v = VersionPredicate("p1.p2.p3.p4(>=1.0, <=1.3a1, !=1.2zb3)") + Traceback (most recent call last): + ... + ValueError: invalid version number '1.2zb3' + + """ + + def __init__(self, versionPredicateStr): + """Parse a version predicate string. + """ + # Fields: + # name: package name + # pred: list of (comparison string, StrictVersion) + + versionPredicateStr = versionPredicateStr.strip() + if not versionPredicateStr: + raise ValueError, "Empty package restriction" + match = re_validPackage.match(versionPredicateStr) + if not match: + raise ValueError, "Bad package name in " + versionPredicateStr + self.name, paren = match.groups() + paren = paren.strip() + if paren: + match = re_paren.match(paren) + if not match: + raise ValueError, "Expected parenthesized list: " + paren + str = match.groups()[0] + self.pred = [splitUp(aPred) for aPred in str.split(",")] + if not self.pred: + raise ValueError("Empty Parenthesized list in %r" + % versionPredicateStr ) + else: + self.pred=[] + + def __str__(self): + if self.pred: + seq = [cond + " " + str(ver) for cond, ver in self.pred] + return self.name + " (" + ", ".join(seq) + ")" + else: + return self.name + + def satisfied_by(self, version): + """True if version is compatible with all the predicates in self. + The parameter version must be acceptable to the StrictVersion + constructor. It may be either a string or StrictVersion. + """ + for cond, ver in self.pred: + if not compmap[cond](version, ver): + return False + return True + + +def check_provision(value): + m = re.match("[a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*(\s*\([^)]+\))?$", value) + if not m: + raise ValueError("illegal provides specification: %r" % value) + return m.group(2) + +def search_projects_by_field(center, field, value): + value = [v for v in value if v] + if not value: + # If there is no search to be done there's no point checking + # the catalogue + raise StopIteration + catalog = getToolByName(center, 'portal_catalog') + sc_path = '/'.join(center.getPhysicalPath()) + query = {'path' : sc_path, + 'portal_type' : 'LECProject'} + if isinstance(value, tuple) or isinstance(value, list): + for name in value: + query[field] = name + projects = catalog(**query) + for brain in projects: + yield brain.getId + else: + query[field] = value + projects = catalog(**query) + for brain in projects: + yield brain.getId + +def get_projects_by_distutils_ids(sc, ids): + primary = search_projects_by_field(sc, 'getDistutilsMainId', ids) + secondary = search_projects_by_field(sc, 'getDistutilsSecondaryIds', ids) + return chain(primary, secondary) + diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/utils.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/utils.pyc Binary files differnew file mode 100644 index 0000000..72afb8c --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/utils.pyc diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/validators.py b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/validators.py new file mode 100644 index 0000000..2482ddc --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/validators.py @@ -0,0 +1,117 @@ +# Old Style + +from Products.validation.interfaces import ivalidator +import re + +# New Style + +try: + # Plone 4 and higher + import plone.app.upgrade + USE_BBB_VALIDATORS = False +except ImportError: + # BBB Plone 3 + USE_BBB_VALIDATORS = True + + +from zope.interface import implements +from Products.validation.interfaces.IValidator import IValidator +from zope.component import adapts +from Products.Archetypes.interfaces import IObjectPreValidation +from am.LiboExtensionCenter.interfaces import IProjectContent + +from zope.i18nmessageid import MessageFactory + + +_ = MessageFactory('liboextensioncenter') + +is_valid_contact = re.compile('[mailto:,http:]') + + +# Old style validators + +class ProjectIdValidator: + """Ensure that we don't get a value for the id of a project that is the same + as the id of a category. This will break our nice acquisition-fuelled + listing templates and generally be bad. + """ + + if USE_BBB_VALIDATORS: + __implements__ = (ivalidator,) + else: + implements(IValidator) + + def __init__(self, name): + self.name = name + return None + + def __call__(self, value, *args, **kwargs): + instance = kwargs['instance'] + if value in instance.getAvailableCategoriesAsDisplayList().keys(): + return "Short name %s is invalid - " \ + "it is the same as the name of a project category" % (value,) + else: + return 1 + +class ProjectContactValidator: + """Check to see if field contains a valid URI (mailto: or http:) + else check for email address else kick it back to the form.""" + + if USE_BBB_VALIDATORS: + __implements__ = (ivalidator,) + else: + implements(IValidator) + + def __init__(self, name): + self.name = name + return None + + + def __call__(self, value, *args, **kwargs): + # if not is_valid_contact(value): + # return """Not a valid contact.""" + #print value + #print is_valid_contact(value) + #return 1 + return """Not a valid contact.""" + + +# New style validators + +class ValidateEggNameUnique(object): + """ Ensure that an egg is not already registered under a different project. """ + + implements(IObjectPreValidation) + adapts(IProjectContent) + + def __init__(self, context): + super(ValidateEggNameUnique, self).__init__() + self.context = context + + def __call__(self, request): + """ Validate that the fields for egg name registrations do not conflict with existing names """ + main = request.get("distutilsMainId", None) + secondary = request.get("distutilsSecondaryIds", None) + if (not main) and secondary: + return {"distutilsMainId":_("You must set the primary package before you can select secondary packages.")} + + main = (main, ) + + if isinstance(secondary, str): + secondary = (secondary, ) + elif isinstance(secondary, list) or isinstance(secondary, tuple): + secondary = tuple(secondary) + else: + return {"distutilsSecondaryIds":_("You must provide a list of package names")} + + errors = {} + + if not self.context._distUtilsNameAvailable(main): + errors['distutilsMainId'] = _("This package is already claimed by another project.") + if not self.context._distUtilsNameAvailable(secondary): + errors['distutilsSecondaryIds'] = _("This contains packages already claimed by another project.") + + if not errors: + return None + else: + return errors diff --git a/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/validators.pyc b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/validators.pyc Binary files differnew file mode 100644 index 0000000..ab8644c --- /dev/null +++ b/LiboExtensionWebsite/am.LiboExtensionCenter/am/LiboExtensionCenter/validators.pyc |