From d4572bf26ac625af9663de6cb8f50b3d0fac0a05 Mon Sep 17 00:00:00 2001 From: Dave Andreoli Date: Tue, 20 Jan 2015 01:58:57 +0100 Subject: [PATCH] Keep track of installed files by py version Now you can install/uninstall using more than one python versions --- .gitignore | 2 +- setup.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index bd20939..26e8db9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ *.py[co] MANIFEST -installed_files.txt +installed_files-*.txt # Packages *.egg diff --git a/setup.py b/setup.py index 2ad00ed..b37ec58 100755 --- a/setup.py +++ b/setup.py @@ -125,6 +125,7 @@ class CleanGenerated(Command): # === setup.py uninstall command === +RECORD_FILE = "installed_files-%d.%d.txt" % sys.version_info[:2] class Uninstall(Command): description = 'remove all the installed files recorded at installation time' user_options = [] @@ -153,10 +154,10 @@ class Uninstall(Command): directory = os.path.dirname(directory) def run(self): - if not os.path.exists("installed_files.txt"): - print('Warning: No installed_files.txt file found!') + if not os.path.exists(RECORD_FILE): + print('ERROR: No %s file found!' % RECORD_FILE) else: - for entry in open("installed_files.txt").read().split(): + for entry in open(RECORD_FILE).read().split(): self.remove_entry(entry) @@ -511,7 +512,7 @@ setup( 'release': ('setup.py', RELEASE), }, 'install': { - 'record': ('setup.py', 'installed_files.txt'), + 'record': ('setup.py', RECORD_FILE), } }, packages=packages,