source: ore.yui/trunk/setup.py @ 2381

Last change on this file since 2381 was 2381, checked in by mnjoka, 7 years ago

fixed yui-menu zcml config for deploy mode. updated to YUI 2.8.2

File size: 3.0 KB
Line 
1##############################################################################
2#
3# Copyright (c) 2008 Kapil Thangavelu
4# All Rights Reserved.
5#
6# This software is subject to the provisions of the Zope Public License,
7# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11# FOR A PARTICULAR PURPOSE.
12#
13##############################################################################
14import os, setuptools, shutil, urllib2, zipfile
15
16
17rname = 'yui_2.8.2r1'
18url_base = 'http://yuilibrary.com/downloads/yui2'
19version = '0.5.3'
20prefix = 'yui/'
21include_parts = ['/assests', '/build']
22
23dest = os.path.join(os.path.dirname(__file__),
24                    'src', 'ore', 'yui', 'resources')
25                   
26                   
27extpaths = []
28if not os.path.exists(dest):
29    zip_name = rname + '.zip'
30    if not os.path.exists(zip_name):
31        pkg_url = url_base+'/'+zip_name
32        x = urllib2.urlopen( pkg_url ).read()
33        open(zip_name, 'w').write(x)
34
35    zfile = zipfile.ZipFile(zip_name, 'r')
36    lprefix = len(prefix)-1
37
38    for zname in sorted(zfile.namelist()):
39        assert zname.startswith(prefix)
40        zname_part = zname[lprefix:]
41        include_p = False
42        for pi in include_parts:
43            if zname_part.startswith( pi ):
44                include_p = True
45        if not include_p: continue
46        dname = dest + zname_part
47        if dname[-1:] == '/':
48            os.makedirs(dname)
49        else:
50            open(dname, 'w').write(zfile.read(zname))
51            extpaths.append('yui/'+zname[lprefix:])
52else:
53    lbase = len(os.path.dirname(dest))+1
54    for path, dirs, files in os.walk(dest):
55        prefix = path[lbase:]
56        for file in files:
57            extpaths.append(os.path.join(prefix, file))
58
59def read(*rnames):
60    file_path = os.path.join(os.path.dirname(__file__), *rnames)
61    return open( file_path ).read()
62
63setuptools.setup(
64    name = 'ore.yui',
65    version = version,
66    author='Kapil Thangavelu',
67    author_email='kapil.foss@gmail.com',
68    description = "Zope3 Package of the YUI library",
69    long_description=( read('src','ore','yui','README.txt')
70                       + '\n\n' +
71                       read('changes.txt')
72                       ),
73    url='http://pypi.python.org/pypi/ore.yui',
74    namespace_packages = ['ore'],
75    packages = setuptools.find_packages('src'),
76    package_dir = {'':'src'},
77    include_package_data = True,
78    zip_safe=False,
79    package_data = {'ore.yui': extpaths},   
80    install_requires = [
81        'setuptools',
82        'zope.viewlet',
83        'zc.resourcelibrary',
84        ],
85    classifiers=['Programming Language :: Python',
86                 'Environment :: Web Environment',
87                 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
88                 'Framework :: Zope3',
89                 ],   
90    )
Note: See TracBrowser for help on using the repository browser.