Completed
Pull Request — master (#12)
by Jitse
01:00
created

get_readme()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
1
# -*- coding: utf-8 -*-
2
#
3
# Copyright © 2013 Spyder Project Contributors
4
# Licensed under the terms of the MIT License
5
# (see LICENSE.txt for details)
6
7
from setuptools import setup, find_packages
8
import os
9
import os.path as osp
10
11
12
def get_version():
13
    """Get version from source file"""
14
    import codecs
15
    with codecs.open("spyder_memory_profiler/__init__.py", encoding="utf-8") as f:
16
        lines = f.read().splitlines()
17
        for l in lines:
18
            if "__version__" in l:
19
                version = l.split("=")[1].strip()
20
                version = version.replace("'", '').replace('"', '')
21
                return version
22
23
24
def get_package_data(name, extlist):
25
    """Return data files for package *name* with extensions in *extlist*"""
26
    flist = []
27
    # Workaround to replace os.path.relpath (not available until Python 2.6):
28
    offset = len(name) + len(os.pathsep)
29
    for dirpath, _dirnames, filenames in os.walk(name):
30
        for fname in filenames:
31
            if not fname.startswith('.') and osp.splitext(fname)[1] in extlist:
32
                flist.append(osp.join(dirpath, fname)[offset:])
33
    return flist
34
35
36
# Requirements
37
REQUIREMENTS = ['memory_profiler', 'spyder>=3']
38
EXTLIST = ['.jpg', '.png', '.json', '.mo', '.ini']
39
LIBNAME = 'spyder_memory_profiler'
40
41
LONG_DESCRIPTION = """
42
This is a plugin for the Spyder IDE that integrates the Python memory profiler.
43
It allows you to see the memory usage in every line.
44
45
Usage
46
-----
47
48
Add a ``@profile`` decorator to the functions that you wish to profile then
49
press Ctrl+Shift+F10 to run the profiler on the current script, or go to
50
``Run > Profile memory line by line``.
51
52
The results will be shown in a dockwidget, grouped by function. Lines with a
53
stronger color have the largest increments in memory usage.
54
"""
55
56
setup(
57
    name=LIBNAME,
58
    version=get_version(),
59
    packages=find_packages(),
60
    package_data={LIBNAME: get_package_data(LIBNAME, EXTLIST)},
61
    keywords=["Qt PyQt4 PyQt5 PySide spyder plugins spyplugins profiler"],
62
    install_requires=REQUIREMENTS,
63
    url='https://github.com/spyder-ide/spyder-memory-profiler',
64
    license='MIT',
65
    author='Spyder Project Contributors',
66
    description='Plugin for the Spyder IDE that integrates the Python'
67
        ' memory profiler',
68
    long_description=LONG_DESCRIPTION,
69
    classifiers=[
70
        'Development Status :: 4 - Beta',
71
        'Environment :: X11 Applications :: Qt',
72
        'Environment :: Win32 (MS Windows)',
73
        'Intended Audience :: Developers',
74
        'License :: OSI Approved :: MIT License',
75
        'Operating System :: OS Independent',
76
        'Programming Language :: Python :: 2',
77
        'Programming Language :: Python :: 2.7',
78
        'Programming Language :: Python :: 3',
79
        'Programming Language :: Python :: 3.5',
80
        'Programming Language :: Python :: 3.6',
81
        'Topic :: Software Development',
82
        'Topic :: Text Editors :: Integrated Development Environments (IDE)'])
83