Provide the uninstall command for python-efl itself

This commit is contained in:
Davide Andreoli 2015-01-04 16:00:15 +01:00
parent 7b135c2012
commit 625503bf11
2 changed files with 60 additions and 19 deletions

35
INSTALL
View File

@ -6,7 +6,7 @@
- Tested with Python 2.6 / 2.7 / 3.2 / 3.3 / 3.4
* Cython 0.19 or higher (http://cython.org/)
- Tested with Cython 0.19.1
- Tested with Cython 0.21.2
* EFL core library
- eo, evas, ecore, edje, emotion and elementary
@ -26,7 +26,9 @@
======================
Once EFL is built and installed in your desired destination, proceed with
building the wrapper.
building the wrapper using:
python setup.py build
Distribution tarballs include pre-generated C source files, so
cython usage is disabled by default, while is enabled in development git
@ -48,10 +50,17 @@
3. CLEANUP
==========
* For cleaning up
* For cleaning up:
python setup.py clean --all
* To also remove all the C/HTML files generated by Cython:
python setup.py clean_generated_files
WARNING: you will need cython to regenerate the C files, do not use this
command in distribution tarballs, unless you know what are you doing.
4. INSTALLATION
@ -59,7 +68,7 @@
* For system-wide installation (needs administrator privileges):
python setup.py install
(sido) python setup.py install
* For user installation:
@ -67,12 +76,15 @@
* To install for python3:
python3 setup.py install (also cython need to be installed with py3)
(sudo) python3 setup.py install (also cython need to be installed with py3)
* Install with a custom prefix:
python setup.py install --prefix=/MY_PREFIX
(sudo) python setup.py install --prefix=/MY_PREFIX
* You can also uninstall using:
(sudo) python setup.py uninstall
5. DOCUMENTATION
@ -105,14 +117,3 @@
The scripts in examples/ folder must be run by the user as they require
user interaction.
7. UNINSTALL
============
Unfortunately setup.py does not provide a way to remove the installed packages,
To completely remove the installed stuff just remove the 'efl' folder in
your python installation, usually /usr/(local/)lib/pythonX.X/dist-packages/efl

View File

@ -128,6 +128,42 @@ class CleanGenerated(Command):
os.remove(fullpath)
# === setup.py uninstall command ===
class Uninstall(Command):
description = 'remove all the installed files recorded at installation time'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def remove_entry(self, entry):
if os.path.isfile(entry):
try:
print("removing file %s" % entry)
os.unlink(entry)
except OSError as e:
error(e)
directory = os.path.dirname(entry)
while os.listdir(directory) == []:
try:
print("removing empty directory %s" % directory)
os.rmdir(directory)
except OSError as e:
error(e)
directory = os.path.dirname(directory)
def run(self):
if not os.path.exists("installed_files.txt"):
print('Warning: No installed_files.txt file found!')
else:
for entry in open("installed_files.txt").read().split():
self.remove_entry(entry)
# === use cython or pre-generated C files ===
USE_CYTHON = False
if os.getenv("DISABLE_CYTHON") is not None:
@ -439,12 +475,16 @@ setup(
],
cmdclass={
'build_doc': BuildDoc,
'clean_generated_files': CleanGenerated
'clean_generated_files': CleanGenerated,
'uninstall': Uninstall,
},
command_options={
'build_doc': {
'version': ('setup.py', VERSION),
'release': ('setup.py', RELEASE)
'release': ('setup.py', RELEASE),
},
'install': {
'record': ('setup.py', 'installed_files.txt'),
}
},
packages=packages,