File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import memory_profiler
1+ import os
2+ import io
3+ import re
24from distutils .core import setup
35import setuptools
46
7+
8+ # https://packaging.python.org/guides/single-sourcing-package-version/
9+ def read (* names , ** kwargs ):
10+ with io .open (
11+ os .path .join (os .path .dirname (__file__ ), * names ),
12+ encoding = kwargs .get ("encoding" , "utf8" )
13+ ) as fp :
14+ return fp .read ()
15+
16+
17+ def find_version (* file_paths ):
18+ version_file = read (* file_paths )
19+ version_match = re .search (r"^__version__ = ['\"]([^'\"]*)['\"]" ,
20+ version_file , re .M )
21+ if version_match :
22+ return version_match .group (1 )
23+
24+
525CLASSIFIERS = """\
626 Development Status :: 5 - Production/Stable
727Intended Audience :: Science/Research
2444 name = 'memory_profiler' ,
2545 description = 'A module for monitoring memory usage of a python program' ,
2646 long_description = open ('README.rst' ).read (),
27- version = memory_profiler .__version__ ,
47+ version = find_version ( " memory_profiler.py" ) ,
2848 author = 'Fabian Pedregosa' ,
2949 author_email = 'f@bianp.net' ,
3050 url = 'http://pypi.python.org/pypi/memory_profiler' ,
You can’t perform that action at this time.
0 commit comments