|
1 | | -""" |
2 | | -Tricks lifted from Django's own setup.py and django_debug_toolbar. |
3 | | -""" |
4 | | - |
5 | | -from distutils.core import setup |
6 | | -from distutils.command.install_data import install_data |
7 | | -from distutils.command.install import INSTALL_SCHEMES |
8 | | -import os |
9 | | -import sys |
10 | | - |
11 | | -class osx_install_data(install_data): |
12 | | - # On MacOS, the platform-specific lib dir is /System/Library/Framework/Python/.../ |
13 | | - # which is wrong. Python 2.5 supplied with MacOS 10.5 has an Apple-specific fix |
14 | | - # for this in distutils.command.install_data#306. It fixes install_lib but not |
15 | | - # install_data, which is why we roll our own install_data class. |
16 | | - |
17 | | - def finalize_options(self): |
18 | | - # By the time finalize_options is called, install.install_lib is set to the |
19 | | - # fixed directory, so we set the installdir to install_lib. The |
20 | | - # install_data class uses ('install_data', 'install_dir') instead. |
21 | | - self.set_undefined_options('install', ('install_lib', 'install_dir')) |
22 | | - install_data.finalize_options(self) |
23 | | - |
24 | | -if sys.platform == "darwin": |
25 | | - cmdclasses = {'install_data': osx_install_data} |
26 | | -else: |
27 | | - cmdclasses = {'install_data': install_data} |
28 | | - |
29 | | -def fullsplit(path, result=None): |
30 | | - """ |
31 | | - Split a pathname into components (the opposite of os.path.join) in a |
32 | | - platform-neutral way. |
33 | | - """ |
34 | | - if result is None: |
35 | | - result = [] |
36 | | - head, tail = os.path.split(path) |
37 | | - if head == '': |
38 | | - return [tail] + result |
39 | | - if head == path: |
40 | | - return result |
41 | | - return fullsplit(head, [tail] + result) |
42 | | - |
43 | | -# Tell distutils to put the data_files in platform-specific installation |
44 | | -# locations. See here for an explanation: |
45 | | -# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb |
46 | | -for scheme in INSTALL_SCHEMES.values(): |
47 | | - scheme['data'] = scheme['purelib'] |
48 | | - |
49 | | -# Compile the list of packages available, because distutils doesn't have |
50 | | -# an easy way to do this. |
51 | | -packages, data_files = [], [] |
52 | | -root_dir = os.path.dirname(__file__) |
53 | | -if root_dir != '': |
54 | | - os.chdir(root_dir) |
55 | | - |
56 | | -django_dir = 'googlegeocoder' |
57 | | - |
58 | | -for dirpath, dirnames, filenames in os.walk(django_dir): |
59 | | - # Ignore dirnames that start with '.' |
60 | | - for i, dirname in enumerate(dirnames): |
61 | | - if dirname.startswith('.'): del dirnames[i] |
62 | | - if '__init__.py' in filenames: |
63 | | - packages.append('.'.join(fullsplit(dirpath))) |
64 | | - elif filenames: |
65 | | - data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]]) |
66 | | - |
67 | | -# Small hack for working with bdist_wininst. |
68 | | -# See http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html |
69 | | -if len(sys.argv) > 1 and sys.argv[1] == 'bdist_wininst': |
70 | | - for file_info in data_files: |
71 | | - file_info[0] = '\\PURELIB\\%s' % file_info[0] |
72 | | - |
73 | | -setup(name='python-googlegeocoder', |
74 | | - version='0.2.0', |
75 | | - description='A simple Python wrapper for version three of Google\'s geocoder API', |
76 | | - author='Ben Welsh', |
77 | | - author_email='ben.welsh@latimes.com', |
78 | | - url='http://datadesk.github.com/python-googlegeocoder/', |
79 | | - packages=packages, |
80 | | - cmdclass = cmdclasses, |
81 | | - data_files=data_files, |
82 | | - include_package_data=True, |
83 | | - install_requires=["six>=1.4.1",] |
84 | | - ) |
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +from setuptools import setup |
| 4 | + |
| 5 | +setup( |
| 6 | + name='python-googlegeocoder', |
| 7 | + version='0.3.0', |
| 8 | + description='A simple Python wrapper for version three of Google\'s geocoder API', |
| 9 | + author='Ben Welsh', |
| 10 | + author_email='ben.welsh@latimes.com', |
| 11 | + url='http://datadesk.github.com/python-googlegeocoder/', |
| 12 | + packages=( |
| 13 | + "googlegeocoder", |
| 14 | + ), |
| 15 | + install_requires=("six>=1.4.1",) |
| 16 | +) |
0 commit comments