Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 440808

Summary: python-r1 provide function to compile/install python scripts/modules
Product: Gentoo Linux Reporter: Julian Ospald <hasufell>
Component: EclassesAssignee: Michał Górny <mgorny>
Status: RESOLVED FIXED    
Severity: normal CC: python
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: ideskconfig-0.9.1.ebuild

Description Julian Ospald 2012-11-01 17:57:48 UTC
Created attachment 327960 [details]
ideskconfig-0.9.1.ebuild

given the case I have a bunch of loose python scripts and want to inject them properly into the system, maybe even with multiple-abi support

example ebuild from sunrise overlay.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-11-01 21:10:42 UTC
So, the goal is to install N python modules onto the system, of which one is a Python script, correct? Nothing more, nothing less than that?

I believe a python_domodule() and python_doscript() would be pretty useful in this case. Do you agree?
Comment 2 Julian Ospald 2012-11-02 01:11:44 UTC
could be

a thing that bothers me is that I'm not sure how to best fix the symlink thing. I made some weird python_foreach_impl magic, but meh

another way would be to fix the "import blah" in the "modules" so we can install the "script" seperately. But that requires patching.

these are basically scripts that are meant to be run from the same dir. There are more things like that, i.e. "sabnzbd" from sunrise overlay. Not sure what logic is best to apply here.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-11-02 09:26:11 UTC
(In reply to comment #2)
> could be
> 
> a thing that bothers me is that I'm not sure how to best fix the symlink
> thing. I made some weird python_foreach_impl magic, but meh
> 
> another way would be to fix the "import blah" in the "modules" so we can
> install the "script" seperately. But that requires patching.
> 
> these are basically scripts that are meant to be run from the same dir.
> There are more things like that, i.e. "sabnzbd" from sunrise overlay. Not
> sure what logic is best to apply here.

As far as I can see, this script has 'if __name__ == "__main__":' so you may try doing something like creating /usr/bin/newscript with:

  from idesk_config import IDeskConfig

  IDeskConfig().main()
Comment 4 Julian Ospald 2012-11-02 12:47:18 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > could be
> > 
> > a thing that bothers me is that I'm not sure how to best fix the symlink
> > thing. I made some weird python_foreach_impl magic, but meh
> > 
> > another way would be to fix the "import blah" in the "modules" so we can
> > install the "script" seperately. But that requires patching.
> > 
> > these are basically scripts that are meant to be run from the same dir.
> > There are more things like that, i.e. "sabnzbd" from sunrise overlay. Not
> > sure what logic is best to apply here.
> 
> As far as I can see, this script has 'if __name__ == "__main__":' so you may
> try doing something like creating /usr/bin/newscript with:
> 
>   from idesk_config import IDeskConfig
> 
>   IDeskConfig().main()

I don't like that either, cause it requires manual intervention. But whatever, that's no big deal.

I would second python_domodule and python_doscript for now. For domodule I should be able to control the relative destination (e.g. if I want to install it into a subdir of site-packages or just in the basedir)
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-11-02 19:47:50 UTC
(In reply to comment #4)
> I would second python_domodule and python_doscript for now. For domodule I
> should be able to control the relative destination (e.g. if I want to
> install it into a subdir of site-packages or just in the basedir)

Hmm, if I am to do this similarly to helpers in Gentoo, that'd probably be a helperinto function, but it'd have to take the absolute path, I believe.

In most cases 'python_domod -r' will just solve most of the cases, I guess.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-11-04 00:07:41 UTC
Note to self: make the module compilation function public
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-12-09 09:56:58 UTC
Well, I think that's all fixed and documented now (in python-utils-r1).