Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /iDDS/setup.py was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #!/usr/bin/env python
0002 #
0003 # Licensed under the Apache License, Version 2.0 (the "License");
0004 # You may not use this file except in compliance with the License.
0005 # You may obtain a copy of the License at
0006 # http://www.apache.org/licenses/LICENSE-2.0OA
0007 #
0008 # Authors:
0009 # - Wen Guan, <wen.guan@cern.ch>, 2019
0010 
0011 """
0012 Legacy setup.py wrapper for backward compatibility.
0013 Please use build_all.py or pyproject.toml-based builds instead.
0014 """
0015 
0016 import os
0017 import subprocess
0018 import sys
0019 
0020 
0021 def setup(argv):
0022     """
0023     Wrapper around build_all.py for backward compatibility.
0024     Maps old setup.py commands to new build_all.py commands.
0025     """
0026     current_dir = os.path.dirname(os.path.realpath(__file__))
0027     build_script = os.path.join(current_dir, 'build_all.py')
0028     
0029     # Map old setup.py commands to new build_all.py commands
0030     command_map = {
0031         'install': 'install',
0032         'develop': 'develop',
0033         'build': 'build',
0034         'bdist_wheel': 'wheel',
0035         'sdist': 'build',
0036         'clean': 'clean',
0037     }
0038     
0039     # Parse the command from argv
0040     if len(argv) > 0:
0041         old_command = argv[0]
0042         new_command = command_map.get(old_command, None)
0043         
0044         if new_command:
0045             cmd = f'python {build_script} {new_command}'
0046             print(f"Running: {cmd}")
0047             print(f"(Mapped from setup.py {old_command})")
0048             return subprocess.call(cmd, shell=True)
0049         else:
0050             print(f"Warning: Command '{old_command}' not supported.")
0051             print("Please use build_all.py directly or one of: install, develop, build, wheel, clean")
0052             return 1
0053     else:
0054         # No command specified, show help
0055         cmd = f'python {build_script}'
0056         print("No command specified. Running build_all.py...")
0057         print(f"Usage: python setup.py [install|develop|build|bdist_wheel|clean]")
0058         print(f"Or use directly: python build_all.py [command]")
0059         return subprocess.call(cmd, shell=True)
0060 
0061 
0062 if __name__ == '__main__':
0063     sys.exit(setup(sys.argv[1:]))
0064