From 49a7c21ed2c1d38e8cac2f65223da7884551ea91 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Mon, 30 Sep 2019 23:59:20 -0700 Subject: [PATCH] Move version number into VERSION file to avoid importing mem_edit in setup.py --- MANIFEST.in | 1 + mem_edit/VERSION | 1 + mem_edit/__init__.py | 6 +++++- setup.py | 9 ++++++--- 4 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 mem_edit/VERSION diff --git a/MANIFEST.in b/MANIFEST.in index c28ab72..2b8b271 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include README.md include LICENSE.md +include mem_edit/VERSION diff --git a/mem_edit/VERSION b/mem_edit/VERSION new file mode 100644 index 0000000..3b04cfb --- /dev/null +++ b/mem_edit/VERSION @@ -0,0 +1 @@ +0.2 diff --git a/mem_edit/__init__.py b/mem_edit/__init__.py index 8391f4f..8947638 100644 --- a/mem_edit/__init__.py +++ b/mem_edit/__init__.py @@ -12,12 +12,16 @@ To get started, try: """ import platform +import pathlib from .utils import MemEditError __author__ = 'Jan Petykiewicz' -version = '0.2' + +with open(pathlib.Path(__file__).parent / 'VERSION', 'r') as f: + __version__ = f.read().strip() +version = __version__ system = platform.system() diff --git a/setup.py b/setup.py index bec3d13..5f6ecf2 100644 --- a/setup.py +++ b/setup.py @@ -1,15 +1,15 @@ #!/usr/bin/env python3 from setuptools import setup, find_packages -import mem_edit - with open('README.md', 'r') as f: long_description = f.read() +with open('mem_edit/VERSION', 'r') as f: + version = f.read().strip() setup(name='mem_edit', - version=mem_edit.version, + version=version, description='Multi-platform library for memory editing', long_description=long_description, long_description_content_type='text/markdown', @@ -50,6 +50,9 @@ setup(name='mem_edit', 'Topic :: Utilities', ], packages=find_packages(), + package_data={ + 'mem_edit': ['VERSION'] + }, install_requires=[ 'typing', ],