Skip to content

Conversation

@smoors
Copy link
Contributor

@smoors smoors commented Apr 8, 2021

post install commands can be done with a hack if using python setup.py install:

'installopts': ' && some_post_install_stuff',

with pip however, this hack is not possible.

this PR adds support for post install commands for each individual extension, so one can use it in the same way as the usual postinstallcmds:

'ext_postinstallcmds': [list of commands]',

Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

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

Since postinstallcmds is already in framework, I think it would be better to name this option to something like ext_postinstallcmds so that it'll turn up when searching the repo

@smoors
Copy link
Contributor Author

smoors commented Apr 8, 2021

@ocaisa thanks for the suggestions.
I've changed it to ext_postinstallcmds and made the code similar to how postinstallcmds was implemented, with added type checks.
I've also changed the default value to None instead of [] as this is also the case for postinstallcmds.

Copy link
Member

@ocaisa ocaisa left a comment

Choose a reason for hiding this comment

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

Code LGTM, have you got an easyconfig that uses it?

@smoors
Copy link
Contributor Author

smoors commented Apr 9, 2021

@ocaisa
Copy link
Member

ocaisa commented Apr 10, 2021

Tested with easybuilders/easybuild-easyconfigs#12559 and looks good, relevant output excerpt below, no impact on other extensions and does what it says on the tin:

== installing extension about 5.2 (5/7)...
  >> defining build environment for foss/2020b toolchain
  >> running command:
	[started at: 2021-04-10 08:02:04]
	[working dir: /users/ocaisa/.local/easybuild/build/DROP/1.0.3/foss-2020b-R-4.0.3/about]
	[output logged in /tmp/eb-7p6f46c9/easybuild-run_cmd-8lijbxou.log]
	tar xzf /shared/maintainers/sources/d/DROP/extensions/about-5.2.tar.gz
  >> command completed: exit 0, ran in < 1s
== 	configuring...
== 	building...
== 	testing...
== 	installing...
  >> running command:
	[started at: 2021-04-10 08:02:05]
	[working dir: /users/ocaisa/.local/easybuild/build/DROP/1.0.3/foss-2020b-R-4.0.3/about/about-5.2]
	[output logged in /tmp/eb-7p6f46c9/easybuild-run_cmd-jqxzxvve.log]
	pip install --prefix=/users/ocaisa/.local/easybuild/software/DROP/1.0.3-foss-2020b-R-4.0.3  --no-deps  --ignore-installed  --no-build-isolation  .
  >> command completed: exit 0, ran in 00h00m01s
== installing extension pandoc 1.0.2 (6/7)...
  >> defining build environment for foss/2020b toolchain
  >> running command:
	[started at: 2021-04-10 08:02:07]
	[working dir: /users/ocaisa/.local/easybuild/build/DROP/1.0.3/foss-2020b-R-4.0.3/pandoc]
	[output logged in /tmp/eb-7p6f46c9/easybuild-run_cmd-9tvs15xk.log]
	tar xzf /shared/maintainers/sources/d/DROP/extensions/v1.0.2.tar.gz
  >> command completed: exit 0, ran in < 1s
== 	configuring...
== 	building...
== 	testing...
== 	installing...
  >> running command:
	[started at: 2021-04-10 08:02:07]
	[working dir: /users/ocaisa/.local/easybuild/build/DROP/1.0.3/foss-2020b-R-4.0.3/pandoc/pandoc-1.0.2]
	[output logged in /tmp/eb-7p6f46c9/easybuild-run_cmd-u7trm40w.log]
	pip install --prefix=/users/ocaisa/.local/easybuild/software/DROP/1.0.3-foss-2020b-R-4.0.3  --no-deps  --ignore-installed  --no-build-isolation  .  && cp -a pandoc/definitions /users/ocaisa/.local/easybuild/software/DROP/1.0.3-foss-2020b-R-4.0.3/lib/python3.8/site-packages/pandoc/
  >> command completed: exit 0, ran in 00h00m01s

@ocaisa ocaisa merged commit fea729e into easybuilders:develop Apr 10, 2021
@boegel boegel changed the title add support for post install commands for python extensions add support for post install commands for Python extensions Apr 24, 2021
@boegel boegel added this to the next release (4.3.5?) milestone Apr 24, 2021
},
])

ext_postinstallcmds = self.cfg['ext_postinstallcmds']
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I wonder if it wouldn't have been better to use the existing postinstallcmds instead...

You can already specify postinstallcmds for a specific extension (just like any other common easyconfig parameter), but doing so won't have any effect, unless a change like this is made in easyblocks that are used to install extensions.

So, how about just renaming to ext_postinstallcmds to postinstallcmds here after all (and removing the support for picking up ext_postinstallcmds, while this is still only in develop?

cc @smoors, @ocaisa

Copy link
Contributor Author

@smoors smoors Apr 25, 2021

Choose a reason for hiding this comment

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

@boegel that would indeed be better.
I went for another parameter to avoid the clash with the global postinstallcmds, but it's easy to fix this, by adding this line to the __init__ function in extensionblock.py (similar to the start_dir parameter):

self.cfg['postinstallcmds'] = self.ext.get('options', {}).get('postinstallcmds', None)

because of the clash I assumed this was intended, but now I understand it was just not yet implemented.
I can make a PR for this if that's the way to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants