Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1382: setup_with_locale.patch

File setup_with_locale.patch, 4.0 KB (added by chrisz, 5 years ago)

Adds locales directory to setup.py and improve get_package_name in util.py

  • turbogears/qstemplates/quickstart/setup.py_tmpl

     
    44import os 
    55execfile(os.path.join("${package}", "release.py")) 
    66 
     7packages=find_packages() 
     8package_data = find_package_data(where='${package}', 
     9    package='${package}') 
     10if os.path.isdir('locales'): 
     11    packages.append('locales') 
     12    package_data.update(find_package_data(where='locales', 
     13        exclude=('*.po',), only_in_packages=False)) 
     14 
    715setup( 
    816    name="${project}", 
    917    version=version, 
    10      
     18 
    1119    # uncomment the following lines if you fill them out in release.py 
    1220    #description=description, 
    1321    #author=author, 
     
    1523    #url=url, 
    1624    #download_url=download_url, 
    1725    #license=license, 
    18      
    19     install_requires = [ 
     26 
     27    install_requires=[ 
    2028        "TurboGears >= ${turbogearsversion}", 
    21 #if $identity == "sqlalchemy"  
    22         "SQLAlchemy",  
    23 #end if  
     29#if $identity == "sqlalchemy" 
     30        "SQLAlchemy", 
     31#end if 
    2432    ], 
    25     scripts = ["start-${package}.py"], 
     33    scripts=["start-${package}.py"], 
    2634    zip_safe=False, 
    27     packages=find_packages(), 
    28     package_data = find_package_data(where='${package}', 
    29                                      package='${package}'), 
    30     keywords = [ 
     35    packages=packages, 
     36    package_data=package_data, 
     37    keywords=[ 
    3138        # Use keywords if you'll be adding your package to the 
    3239        # Python Cheeseshop 
    33          
     40 
    3441        # if this has widgets, uncomment the next line 
    3542        # 'turbogears.widgets', 
    36          
     43 
    3744        # if this has a tg-admin command, uncomment the next line 
    3845        # 'turbogears.command', 
    39          
     46 
    4047        # if this has identity providers, uncomment the next line 
    4148        # 'turbogears.identity.provider', 
    42      
     49 
    4350        # If this is a template plugin, uncomment the next line 
    4451        # 'python.templating.engines', 
    45          
     52 
    4653        # If this is a full application, uncomment the next line 
    4754        # 'turbogears.app', 
    4855    ], 
    49     classifiers = [ 
     56    classifiers=[ 
    5057        'Development Status :: 3 - Alpha', 
    5158        'Operating System :: OS Independent', 
    5259        'Programming Language :: Python', 
     
    5562        # if this is an application that you'll distribute through 
    5663        # the Cheeseshop, uncomment the next line 
    5764        # 'Framework :: TurboGears :: Applications', 
    58          
     65 
    5966        # if this is a package that includes widgets that you'll distribute 
    6067        # through the Cheeseshop, uncomment the next line 
    6168        # 'Framework :: TurboGears :: Widgets', 
    6269    ], 
    63     test_suite = 'nose.collector', 
     70    test_suite='nose.collector', 
    6471    ) 
    65      
     72 
  • turbogears/util.py

     
    101101    if "--egg" in sys.argv: 
    102102        projectname = sys.argv[sys.argv.index("--egg")+1] 
    103103        egg = pkg_resources.get_distribution(projectname) 
    104         package = list(egg._get_metadata("top_level.txt"))[0] 
    105         return package 
    106     fname = get_project_meta('top_level.txt') 
    107     if fname: 
    108         return open(fname).readline()[:-1] 
     104        top_level = egg._get_metadata("top_level.txt") 
     105    else: 
     106        fname = get_project_meta('top_level.txt') 
     107        top_level = fname and open(fname) or [] 
     108    for package in top_level: 
     109        package = package.rstrip() 
     110        if package and package != 'locales': 
     111            return package 
    109112 
    110113def get_project_name(): 
    111114    pkg_info = get_project_meta('PKG-INFO') 
     
    426429           "arg_index", "inject_arg", "inject_args", "bind_args", 
    427430           "recursive_update", "combine_contexts", "request_available", 
    428431           "flatten_sequence", "load_class", "Bunch", 
    429            "parse_http_accept_header",  
     432           "parse_http_accept_header", 
    430433           "to_unicode", "to_utf8", "get_template_encoding_default", 
    431434           "find_precision", "copy_if_mutable"]