All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] sys.path for Python?
@ 2015-07-24 17:09 Peter Senna Tschudin
  2015-07-24 17:17 ` Luis R. Rodriguez
  2015-07-24 17:21 ` SF Markus Elfring
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Senna Tschudin @ 2015-07-24 17:09 UTC (permalink / raw)
  To: cocci

Hi,

I'm writing a set of .cocci files that will use python. I'm making
some helper function that I want to include in multiple files. I'm
doing something like:

@initialize:python@
@@
from Common import *

which works fine, given spatch is called from the folder where
Commom.py is. If I move to the folder where I want to run spatch, and
try the same semantic patch it fails. The solution for now is:

@initialize:python@
@@
import sys
sys.path.append("/home/peter/devel/git/the-conference/devel/featureccinelle/cocci-files/")
from Common import *

So I ask:

- Can I access from Python the path to the semantic patch? Maybe I
could get that from the cmdline of spatch but that would be
complicated.

- Does it make sense to have a python command to extend the path to
append the folder where the semantic patch is in?

Thank you!


-- 
Peter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-24 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 17:09 [Cocci] sys.path for Python? Peter Senna Tschudin
2015-07-24 17:17 ` Luis R. Rodriguez
2015-07-24 17:30   ` Peter Senna Tschudin
2015-07-24 17:21 ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.