Re: Python talking to XPC services?

Glyph <[email protected]> Mon, 31 Dec 2018 10:48:58 -0800
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
--===============6804608423465115792==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_195DEB07-7ABF-47C9-84C7-673FA247B341"


--Apple-Mail=_195DEB07-7ABF-47C9-84C7-673FA247B341
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8



> On Dec 30, 2018, at 2:51 AM, Ronald Oussoren <[email protected]> =
wrote:
>=20
>=20
>=20
>> On 30 Dec 2018, at 07:19, Glyph <[email protected] =
<mailto:[email protected]>> wrote:
>>=20
>> I've long been curious about if and how one could use XPC services =
with Python, and I recently ran across this question:
>>=20
>> =
https://stackoverflow.com/questions/52284089/is-it-possible-to-use-pyobjc-=
with-a-privilved-xpc-helper-tool-and-xpcinterface-a =
<https://stackoverflow.com/questions/52284089/is-it-possible-to-use-pyobjc=
-with-a-privilved-xpc-helper-tool-and-xpcinterface-a>
>>=20
>> If anyone on this list happens to have the relevant understanding, I =
put a 100-point bounty on it.
>>=20
>> Happy holidays,
>=20
>=20
> I hadn=E2=80=99t seen this question yet, mostly because I rarely visit =
stackoverflow.  A quick summary of my answer:
>=20
> 1) It is possible to call APIs with blocks, even if those APIs =
aren=E2=80=99t in Apple=E2=80=99s frameworks
>=20
> 2) It is possible to define ObjC protocols in Python
>=20
> 3) Those protocols don=E2=80=99t work with NSXPCInterface yet (issue =
#256), but there is an (untested) workaround
>=20
> I wonder how hard it will be to fix #256, with some luck =
NSXPCInterface access information that isn=E2=80=99t exposed through a =
public API.  In particular, the NSXPCInterface error mentions =
=E2=80=9Cextended method signature=E2=80=9D and I haven=E2=80=99t found =
any reference to those yet in Apple documentation.

Thanks for having a look at this!  Good luck on figuring out what an =
"extended method signature" is, I hope that's tractable.

I don't know if it will be helpful for this purpose, but Ian Beer has a =
talk about macOS IPC mechanisms - from the perspective of exploiting =
them, rather than programming against them :) but perhaps some of the =
internal details he talks about will be useful to you:

https://vimeo.com/127859750 <https://vimeo.com/127859750>

(Frankly a lot of this stuff goes over my head; I don't know a whole lot =
about Mach and the more I learn about ports the scarier they seem.)

-g


--Apple-Mail=_195DEB07-7ABF-47C9-84C7-673FA247B341
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Dec 30, 2018, at 2:51 AM, Ronald Oussoren &lt;<a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><meta =
http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8" =
class=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: =
space; line-break: after-white-space;" class=3D""><br class=3D""><div =
class=3D"">
</div>
<div class=3D""><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On 30 Dec 2018, at 07:19, Glyph &lt;<a =
href=3D"mailto:[email protected]" =
class=3D"">[email protected]</a>&gt; wrote:</div><br =
class=3D"Apple-interchange-newline"><div class=3D""><meta =
http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii" =
class=3D""><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: =
space; line-break: after-white-space;" class=3D""><div class=3D"">I've =
long been curious about if and how one could use XPC services with =
Python, and I recently ran across this question:</div><div class=3D""><br =
class=3D""></div><a =
href=3D"https://stackoverflow.com/questions/52284089/is-it-possible-to-use=
-pyobjc-with-a-privilved-xpc-helper-tool-and-xpcinterface-a" =
class=3D"">https://stackoverflow.com/questions/52284089/is-it-possible-to-=
use-pyobjc-with-a-privilved-xpc-helper-tool-and-xpcinterface-a</a><div =
class=3D""><br class=3D""></div><div class=3D"">If anyone on this list =
happens to have the relevant understanding, I put a 100-point bounty on =
it.</div><div class=3D""><br class=3D""></div><div class=3D"">Happy =
holidays,</div></div></div></blockquote><div class=3D""><br =
class=3D""></div><div class=3D""><br class=3D""></div>I hadn=E2=80=99t =
seen this question yet, mostly because I rarely visit stackoverflow. =
&nbsp;A quick summary of my answer:</div><div class=3D""><br =
class=3D""></div><div class=3D"">1) It is possible to call APIs with =
blocks, even if those APIs aren=E2=80=99t in Apple=E2=80=99s =
frameworks</div><div class=3D""><br class=3D""></div><div class=3D"">2) =
It is possible to define ObjC protocols in Python</div><div class=3D""><br=
 class=3D""></div><div class=3D"">3) Those protocols don=E2=80=99t work =
with NSXPCInterface yet (issue #256), but there is an (untested) =
workaround</div><div class=3D""><br class=3D""></div><div class=3D"">I =
wonder how hard it will be to fix #256, with some luck NSXPCInterface =
access information that isn=E2=80=99t exposed through a public API. =
&nbsp;In particular, the NSXPCInterface error mentions =E2=80=9Cextended =
method signature=E2=80=9D and I haven=E2=80=99t found any reference to =
those yet in Apple documentation.</div></div></div></blockquote><br =
class=3D""></div><div>Thanks for having a look at this! &nbsp;Good luck =
on figuring out what an "extended method signature" is, I hope that's =
tractable.</div><div><br class=3D""></div><div>I don't know if it will =
be helpful for this purpose, but Ian Beer has a talk about macOS IPC =
mechanisms - from the perspective of exploiting them, rather than =
programming against them :) but perhaps some of the internal details he =
talks about will be useful to you:</div><div><br class=3D""></div><div><a =
href=3D"https://vimeo.com/127859750" =
class=3D"">https://vimeo.com/127859750</a></div><div><br =
class=3D""></div><div>(Frankly a lot of this stuff goes over my head; I =
don't know a whole lot about Mach and the more I learn about ports the =
scarier they seem.)</div><div><br class=3D""></div><div>-g</div><br =
class=3D""></body></html>=

--Apple-Mail=_195DEB07-7ABF-47C9-84C7-673FA247B341--


--===============6804608423465115792==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============6804608423465115792==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Pyobjc-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyobjc-dev

--===============6804608423465115792==--