summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2015-01-04 16:00:15 +0100
committerDave Andreoli <dave@gurumeditation.it>2015-01-04 16:00:15 +0100
commit625503bf118ded35227ea4506afe342ce4cb0c21 (patch)
treefab838528505b2704441248a483f66c9c22044a2 /setup.py
parent7b135c20128ebbc007b01edf7c216872133b87ca (diff)
Provide the uninstall command for python-efl itself
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py44
1 files changed, 42 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 81b7263..d834649 100755
--- a/setup.py
+++ b/setup.py
@@ -128,6 +128,42 @@ class CleanGenerated(Command):
128 os.remove(fullpath) 128 os.remove(fullpath)
129 129
130 130
131# === setup.py uninstall command ===
132class Uninstall(Command):
133 description = 'remove all the installed files recorded at installation time'
134 user_options = []
135
136 def initialize_options(self):
137 pass
138
139 def finalize_options(self):
140 pass
141
142 def remove_entry(self, entry):
143 if os.path.isfile(entry):
144 try:
145 print("removing file %s" % entry)
146 os.unlink(entry)
147 except OSError as e:
148 error(e)
149
150 directory = os.path.dirname(entry)
151 while os.listdir(directory) == []:
152 try:
153 print("removing empty directory %s" % directory)
154 os.rmdir(directory)
155 except OSError as e:
156 error(e)
157 directory = os.path.dirname(directory)
158
159 def run(self):
160 if not os.path.exists("installed_files.txt"):
161 print('Warning: No installed_files.txt file found!')
162 else:
163 for entry in open("installed_files.txt").read().split():
164 self.remove_entry(entry)
165
166
131# === use cython or pre-generated C files === 167# === use cython or pre-generated C files ===
132USE_CYTHON = False 168USE_CYTHON = False
133if os.getenv("DISABLE_CYTHON") is not None: 169if os.getenv("DISABLE_CYTHON") is not None:
@@ -439,12 +475,16 @@ setup(
439 ], 475 ],
440 cmdclass={ 476 cmdclass={
441 'build_doc': BuildDoc, 477 'build_doc': BuildDoc,
442 'clean_generated_files': CleanGenerated 478 'clean_generated_files': CleanGenerated,
479 'uninstall': Uninstall,
443 }, 480 },
444 command_options={ 481 command_options={
445 'build_doc': { 482 'build_doc': {
446 'version': ('setup.py', VERSION), 483 'version': ('setup.py', VERSION),
447 'release': ('setup.py', RELEASE) 484 'release': ('setup.py', RELEASE),
485 },
486 'install': {
487 'record': ('setup.py', 'installed_files.txt'),
448 } 488 }
449 }, 489 },
450 packages=packages, 490 packages=packages,