Skip to content

Tkinter easyblock#1184

Merged
boegel merged 8 commits intoeasybuilders:developfrom
wpoely86:tkinter
May 23, 2017
Merged

Tkinter easyblock#1184
boegel merged 8 commits intoeasybuilders:developfrom
wpoely86:tkinter

Conversation

@wpoely86
Copy link
Copy Markdown
Member

Follow up from #1118

verdurin and others added 3 commits February 28, 2017 10:56
* origin/develop: (114 commits)
  enable building of shared FFTW libraries
  enhance sanity check for NCL
  Revert "update NCL easyblock to support building in parallel"
  (re-)bump to v3.3.0.dev0
  bump version to v3.2.1, clarify updates to NAMD easyblock in release notes
  prepare release notes for eb321
  minor style fixes in GROMACS w/ PLUMED support
  only use -std=c++11 for NAMD 2.12 and up
  fix specifying FFT(W) dirs + minor style fixes
  Move plumed patching step.
  Add openmp support to namd easyblock. Also add TCL support.
  Fix some more comments from Kenneth.
  bump to v3.3.0.dev0
  bump version to 3.2.0 + minor enhancements to release notes
  prepare release notes for eb320
  integrate support for open-source version of TBB into existing TBB easyblock
  update NCL easyblock to support building in parallel
  PoC for the TBB open source version
  add support to install Python extensions without unpacking
  Improvement, per reviewer suggestion
  ...
Comment thread easybuild/easyblocks/t/tkinter.py Outdated
@author: Dries Verdegem (Ghent University)
@author: Kenneth Hoste (Ghent University)
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop these above, only you and Adam are actual authors of this?


custom_paths = {
'files': [],
'dirs': ['lib']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this more specific, just include 'files': [tkinter_so]?

Should we also check whether nothing else is in the install dir?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we delete everything in there and copy only the tk parts back?

tkinter_so is a glob.

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
"""Set PYTHONPATH"""
txt = super(EB_Tkinter, self).make_module_extra()
pyver = '.'.join(self.version.split('.')[:2])
txt += self.module_generator.prepend_paths('PYTHONPATH', os.path.join("lib", "python%s" % pyver))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use self.all_pylibdirs?

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
shlib_ext = get_shared_lib_ext()

# check whether _tkinter*.so is found, exact filename doesn't matter
tkinter_so = os.path.join(self.installdir, 'lib', pyver, '_tkinter*.' + shlib_ext)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use all_pylibdirs rather than hardcoding lib?

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
mkdir(tmpdir)

pyver = '.'.join(self.version.split('.')[:2])
libdir = os.path.join(self.installdir, "lib", "python%s" % pyver)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, use all_pylibdirs?

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
super(EB_Tkinter, self).install_step()

tmpname = "eb-tmp"
tmpdir = os.path.join(self.installdir, tmpname)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make this a subdir of self.builddir, which is cleaned up automagically?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, use tempfile.mkdtemp, you can tell it in which location to create a directory, and specify a prefix for the name (eb-tmp- for example)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that possible on a different filesystem. The reason why I do it like this is to have a real 'move' on the same fs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that really going to matter for the amount of files involved?

Are you worried about speed, or something else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, some people do weird things out there. But I don't feel strongly about this. I can change if that makes you happy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it's a lot cleaner to use the build dir for this, since it's cleaned up automagically...

Comment thread easybuild/easyblocks/t/tkinter.py Outdated

copy([os.path.join(libdir, x) for x in tkdirs], tmpdir)

delete_dirs = [x for x in os.listdir(self.installdir) if not x == tmpname]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x != tmpname

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and if you use self.builddir in tmpdir, you don't even need to do this, you can just wipe self.installdir entirely?

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
shutil.move(os.path.join(tmpdir, tkdirs[0]), libdir)
shutil.move(os.path.join(tmpdir, os.path.basename(tkdirs[1])), libdir)

rmtree2(tmpdir)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for this if tmpdir uses self.builddir

Comment thread easybuild/easyblocks/t/tkinter.py Outdated

pyver = '.'.join(self.version.split('.')[:2])
libdir = os.path.join(self.installdir, "lib", "python%s" % pyver)
tkdirs = ["lib-tk", "lib-dynload/_tkinter.so"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all of these are dirs, but they are all files (somewhat) ;)

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
"""

def configure_step(self):
"""Check for Tk"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for Tk before configuring

@boegel boegel added this to the 3.3.0 milestone May 22, 2017
Comment thread easybuild/easyblocks/t/tkinter.py Outdated
from distutils.version import LooseVersion

from easybuild.easyblocks.generic.pythonpackage import det_pylibdir
from easybuild.easyblocks.p.python import EB_Python
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use the .p., import directly from easybuild.easyblocks.python

Comment thread easybuild/easyblocks/t/tkinter.py Outdated

mkdir(pylibdir, parents=True)
shutil.move(os.path.join(tmpdir, tkparts[0]), pylibdir)
shutil.move(os.path.join(tmpdir, os.path.basename(tkparts[1])), pylibdir)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrap this in try/except OSError as err:?

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
'files': ['%s/_tkinter.%s' % (pylibdir, shlib_ext)],
'dirs': ['lib']
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop this empty line?

Comment thread easybuild/easyblocks/t/tkinter.py Outdated
try:
shutil.move(os.path.join(tmpdir, tkparts[0]), pylibdir)
shutil.move(os.path.join(tmpdir, os.path.basename(tkparts[1])), pylibdir)
except:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

include the exception in the error message, so it's clear what exactly went wrong...

except OSError as err:
    raise EasyBuildError("Failed to move Tkinter back to the install directory: %s", err)

@boegel
Copy link
Copy Markdown
Member

boegel commented May 23, 2017

lgtm, and tested with easybuilders/easybuild-easyconfigs#4620, thanks @wpoely86 and @verdurin for levelling the ground for this!

@boegel boegel merged commit 5a25efb into easybuilders:develop May 23, 2017
@wpoely86 wpoely86 deleted the tkinter branch May 23, 2017 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants