|
From: Zbigniew R. <zre...@ce...> - 2015-07-06 16:12:26
|
Hi, First of all, I reply to both lists (taurus and sardana) since this ticket was initially created in the sardana queue, and the patch sent by CarlosP, was also sent to the sardana mailing list. After the taurus and sardana projects separation this is the corresponding ticket: http://sourceforge.net/p/tauruslib/tickets/145 Carlos, I have applied your patch to the develop branch. There were just two small corrections: +) in the dftclean.run() you forgot to pass "self" +) I have modified the commit subject to reflect the ticket number change Additionally I have added doc/~thumbnails.zip to the clean. Thanks for your contribution, Zibi On 02/09/2015 10:56 AM, cpa...@ce... wrote: > From: cpascual <cpa...@ce...> > > Running "python setup.py clean" does not remove certain files that > are created by the build command outside of the build directory > (and which, strictly, shouldn't be created there in the first > place). Make the clean command remove those files too. > --- > taurus/setup.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) > > diff --git a/taurus/setup.py b/taurus/setup.py > index 63073a9..6c42097 100644 > --- a/taurus/setup.py > +++ b/taurus/setup.py > @@ -35,6 +35,7 @@ import StringIO > from distutils import log > from distutils.core import setup, Command > from distutils.command.build import build as dftbuild > +from distutils.command.clean import clean as dftclean > from distutils.command.install import install as dftinstall > from distutils.command.install_lib import install_lib as dftinstall_lib > from distutils.command.install_scripts import install_scripts as dftinstall_scripts > @@ -749,6 +750,49 @@ class build_doc_api(Command): > print(i, file=out) > > > +class clean(dftclean): > + def run(self): > + dftclean.run() > + > + # This is a very crude approach to clean the garbage created by taurus > + # outside of the build dir when running the build command > + # see: https://sourceforge.net/p/sardana/tickets/324/ > + import glob > + from distutils.dir_util import remove_tree > + > + # collect the garbage *files* to be deleted > + garbage = [] > + > + resource = abspath('lib', 'taurus', 'qt', 'qtgui', 'resource') > + garbage.extend(glob.glob(os.path.join(resource, '*.rcc'))) > + garbage.extend(glob.glob(os.path.join(resource, '*.qrc'))) > + garbage.append(os.path.join(resource, 'catalog.html')) > + > + jdraw = abspath('lib', 'taurus', 'qt', 'qtgui', 'graphic', 'jdraw') > + garbage.append(os.path.join(jdraw, 'jdraw_lextab.py')) > + garbage.append(os.path.join(jdraw, 'jdraw_yacctab.py')) > + > + doc_devel = abspath('doc', 'source', 'devel') > + garbage.append(os.path.join(doc_devel, 'catalog.html')) > + > + # delete the garbage files > + for fn in garbage: > + if os.path.exists(fn): > + log.info("removing '%s'", fn) > + if self.dry_run: > + continue > + os.remove(fn) > + else: > + log.debug("'%s' does not exist -- can't clean it", fn) > + > + # now delete the api dir > + api_dir = os.path.join(doc_devel, 'api') > + if os.path.exists(api_dir): > + remove_tree(api_dir, dry_run=self.dry_run) > + else: > + log.debug("'%s' does not exist -- can't clean it", api_dir) > + > + > cmdclass = { 'build' : build, > 'build_resources' : build_resources, > 'install' : install, > @@ -756,7 +800,8 @@ cmdclass = { 'build' : build, > 'install_man' : install_man, > 'install_html' : install_html, > 'install_scripts' : install_scripts, > - 'build_doc_api' : build_doc_api } > + 'build_doc_api' : build_doc_api, > + 'clean' : clean } > > if sphinx: > from sphinx.setup_command import BuildDoc -- -- ALBA Synchrotron <http://www.albasynchrotron.es> Zbigniew Reszela Controls Section - Computing Division ALBA SYNCHROTRON LIGHT SOURCE Ctra. BP 1413 km. 3,3 | 08290 | Cerdanyola del Vallès| Barcelona | Spain <http://www.albasynchrotron.es/AboutUs/Access> (+34) 93 592 4407 www.albasynchrotron.es <http://www.albasynchrotron.es>| zre...@ce... <mailto:zre...@ce...> **Please, do not print this e-mail unless it is absolutely necessary. **Si heu rebut aquest correu per error, us informo que pot contenir informació confidencial i privada i que està prohibit el seu ús. Us agrairíem que ho comuniqueu al remitent i l'elimineu. Gràcies. Si ha recibido este correo por error, le informo de que puede contener información confidencial y privada y que está prohibido su uso. Le agradeceré que lo comunique a su remitente y lo elimine. Gracias. If you have received this e-mail in error, please note that it may contain confidential and private information, therefore, the use of this information is strictly forbidden. Please inform the sender of the error and delete the information received. Thank you. |