|
1 | 1 | #!/usr/bin/env python |
2 | | -from __future__ import absolute_import, print_function |
3 | | -from itertools import chain, imap, repeat |
4 | | -from setuptools import setup, find_packages |
5 | | -from os import walk |
6 | | -from os.path import join |
7 | | - |
8 | | -# generated by pymod-generator |
9 | | -# |
10 | | -# DO NOT CHANGE THIS METHOD!! |
11 | | -# to include directories in the module see :package_data: below |
12 | | -# |
13 | | -def include_directories(in_dirs): |
14 | | - paths = list() |
15 | | - for directory in in_dirs: |
16 | | - paths.extend(list(chain.from_iterable(imap(join, repeat(root[len('woocommerce-api') + 1:]), files) for root, _, files in walk(join('woocommerce-api', directory))))) |
17 | | - return paths |
18 | | - |
19 | | -# add list of directories to be included |
20 | | -# |
21 | | -# package_data = include_directories(['dir_to_include', 'other_dir_to_include']) |
22 | | -# |
23 | | -package_data = include_directories([]) |
24 | | - |
25 | | - |
26 | | -# add pypi dependencies here |
27 | | -# |
28 | | -# required_packages = [ |
29 | | -# 'boto', |
30 | | -# 'gunicorn', |
31 | | -# 'gevent', |
32 | | -# 'Flask', |
33 | | -# 'Flask-RESTful' |
34 | | -# ] |
35 | | -# |
36 | | -required_packages = [ |
37 | | - 'requests,oauthlib' |
38 | | - ] |
39 | | - |
40 | | - |
41 | | -# list of scripts that should be linked |
42 | | -# |
43 | | -# 'my-cmd=woocommerce-api.cli:my_cmd_method' |
44 | | -# |
45 | | -scripts = [ |
46 | | - 'hello-woocommerce-api=woocommerce-api.cli:hello' |
47 | | -] |
48 | | - |
49 | | - |
50 | | -setup(name='woocommerce-api', |
51 | | - version='0.1', |
52 | | - description="A Python wrapper for the WooCommerce REST API", |
53 | | - packages=find_packages(), |
54 | | - package_data={ |
55 | | - 'woocommerce-api': package_data |
56 | | - }, |
57 | | - install_requires=required_packages, |
58 | | - entry_points=dict(console_scripts=scripts)) |
| 2 | +# -*- coding: utf-8 -*- |
| 3 | +""" Setup module """ |
| 4 | + |
| 5 | +from setuptools import setup |
| 6 | +import os |
| 7 | +import re |
| 8 | + |
| 9 | + |
| 10 | +# Get version from __init__.py file |
| 11 | +VERSION = '' |
| 12 | +with open('woocommerce-api/__init__.py', 'r') as fd: |
| 13 | + VERSION = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) |
| 14 | + |
| 15 | +if not VERSION: |
| 16 | + raise RuntimeError('Cannot find version information') |
| 17 | + |
| 18 | +# Get long description |
| 19 | +README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read() |
| 20 | + |
| 21 | +# allow setup.py to be run from any path |
| 22 | +os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) |
| 23 | + |
| 24 | +setup( |
| 25 | + name='woocommerce-api', |
| 26 | + version=VERSION, |
| 27 | + description="A Python wrapper for the WooCommerce REST API", |
| 28 | + long_description=README, |
| 29 | + author="Claudio Sanches @ WooThemes", |
| 30 | + url='http://www.woothemes.com', |
| 31 | + license="MIT", |
| 32 | + packages=['woocommerce-api'], |
| 33 | + include_package_data=True, |
| 34 | + install_requires=[ |
| 35 | + "requests", |
| 36 | + "oauthlib" |
| 37 | + ] |
| 38 | +) |
0 commit comments