This is part two of two PRs that will address Issue #1579.

Requires PR #1585 to go in first for atomicity.

As directly invoking python setup.py is considered deprecated behavior by the PyPA, use python -m pip install to install the Python bindings if the Python interpreter has a valid version of pip associated with it.

If there is a valid pip, update pip to the latest release and ensure that setuptools and wheel are installed. Then build and install the Python bindings with python -m pip install.

If there is no valid pip, warn the user and given them instructions on how to get pip on their machine. Attempt to still install the Python bindings by falling back on the deprecated python setup.py build and python setup.py install which will also invoke Easy Install if setuptools v0.60.0+ is used.

Both branches have been tested in Docker image builds

Building with python -m pip install

$ docker run --rm -ti xrootd/xrootd:build-pip-pass 
[root@f6701ee26ac7 /]# python -c "import pyxrootd; print(pyxrootd)"
<module 'pyxrootd' from '/usr/local/venv/lib/python3.8/site-packages/pyxrootd/__init__.py'>
[root@f6701ee26ac7 /]# python -c "import XRootD; print(XRootD)"
<module 'XRootD' from '/usr/local/venv/lib/python3.8/site-packages/XRootD/__init__.py'>
[root@f6701ee26ac7 /]# command -v xrootd
/usr/local/venv/bin/xrootd
[root@f6701ee26ac7 /]# command -v xrdcp
/usr/local/venv/bin/xrdcp
[root@f6701ee26ac7 /]# python
Python 3.8.11 (default, Aug  2 2021, 20:01:57) 
[GCC 8.3.1 20190311 (Red Hat 8.3.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from XRootD import client
>>> from XRootD.client.flags import DirListFlags, OpenFlags, MkDirFlags, QueryCode
>>> myclient = client.FileSystem('root://someserver:1094')
>>> myclient
<XRootD.client.filesystem.FileSystem object at 0x7fb564b22fa0>
>>> 
[root@f6701ee26ac7 /]#

Falling back to python setup.py install

$ docker run --rm -ti xrootd/xrootd:build-setup-py-pass 
[root@62f223b14e6e /]# python -c "import pyxrootd; print(pyxrootd)"
<module 'pyxrootd' from '/usr/local/venv/lib/python3.8/site-packages/xrootd-v20220111_a98ec84-py3.8-linux-x86_64.egg/pyxrootd/__init__.py'>
[root@62f223b14e6e /]# python -c "import XRootD; print(XRootD)"
<module 'XRootD' from '/usr/local/venv/lib/python3.8/site-packages/xrootd-v20220111_a98ec84-py3.8-linux-x86_64.egg/XRootD/__init__.py'>
[root@62f223b14e6e /]# command -v xrootd
/usr/local/venv/bin/xrootd
[root@62f223b14e6e /]# command -v xrdcp
/usr/local/venv/bin/xrdcp
[root@62f223b14e6e /]# python
Python 3.8.11 (default, Aug  2 2021, 20:01:57) 
[GCC 8.3.1 20190311 (Red Hat 8.3.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from XRootD import client
>>> from XRootD.client.flags import DirListFlags, OpenFlags, MkDirFlags, QueryCode
>>> myclient = client.FileSystem('root://someserver:1094')
>>> myclient
<XRootD.client.filesystem.FileSystem object at 0x7f6541b55fa0>
>>> 
[root@62f223b14e6e /]# 

You can view, comment on, or merge this pull request online at:

  https://github.com/xrootd/xrootd/pull/1586

Commit Summary

File Changes

(5 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <xrootd/xrootd/pull/1586@github.com>

[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/xrootd/xrootd/pull/1586", "url": "https://github.com/xrootd/xrootd/pull/1586", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1