Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-09 09:33:10

0001 # Copyright Spack Project Developers. See COPYRIGHT file for details.
0002 #
0003 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 
0005 from spack_repo.builtin.packages.py_rucio_clients.package import (
0006     PyRucioClients as BuiltinPyRucioClients,
0007 )
0008 
0009 from spack.package import *
0010 
0011 
0012 class PyRucioClients(BuiltinPyRucioClients):
0013     __doc__ = BuiltinPyRucioClients.__doc__
0014 
0015     patch("token-upload-client-40.2.0.patch", when="@40.2.0")
0016 
0017     @property
0018     def skip_modules(self):
0019         # rucio.common.schema imports rucio.db, which is only in the server package
0020         modules = ["rucio.common.schema"]
0021         # rucio.common.dumper imports magic (py-python-magic)
0022         if not self.spec.satisfies("+dumper"):
0023             modules.append("rucio.common.dumper")
0024         return modules
0025 
0026     def setup_build_environment(self, env):
0027         # python-venv adds the site-packages directory of a dependent to PYTHONPATH
0028         # only if it exists when the environment is set up, so it is missing while
0029         # the package itself is built and the install-time test_imports fails with
0030         # "No module named 'rucio'"
0031         venv = self.spec["python-venv"].package
0032         for directory in {venv.platlib, venv.purelib}:
0033             env.prepend_path("PYTHONPATH", join_path(self.prefix, directory))
0034 
0035     def test_token_upload(self):
0036         """check that the clients provide token-based upload"""
0037         if not self.spec.satisfies("@40.2.0"):
0038             raise SkipTest("Token upload patch only applies to 40.2.0")
0039         python = self.spec["python"].command
0040         python(
0041             "-c",
0042             "from rucio.client.credentialclient import CredentialClient\n"
0043             "from rucio.client.uploadclient import UploadClient\n"
0044             "assert hasattr(CredentialClient, 'get_upload_token')\n"
0045             "assert hasattr(CredentialClient, 'get_download_token')\n",
0046         )