|  | 
| 1 | 1 | #!/usr/bin/env python3 | 
| 2 |  | -# Software License Agreement (BSD License) | 
| 3 |  | -# | 
| 4 |  | -# Copyright (c) 2017, UFactory, Inc. | 
| 5 |  | -# All rights reserved. | 
| 6 |  | -# | 
| 7 |  | -# Author: Vinman <vinman.wen@ufactory.cc> | 
| 8 |  | - | 
| 9 | 2 | import os | 
| 10 |  | -from distutils.util import convert_path | 
|  | 3 | +import sys | 
|  | 4 | +install_setuptools = False | 
| 11 | 5 | try: | 
| 12 | 6 |     from setuptools import setup, find_packages | 
| 13 | 7 | except ImportError: | 
| 14 |  | -    from distutils.core import setup | 
| 15 |  | - | 
| 16 |  | -    def find_packages(base_path='.'): | 
| 17 |  | -        base_path = convert_path(base_path) | 
| 18 |  | -        found = [] | 
| 19 |  | -        for root, dirs, files in os.walk(base_path, followlinks=True): | 
| 20 |  | -            dirs[:] = [d for d in dirs if d[0] != '.' and d not in ('ez_setup', '__pycache__')] | 
| 21 |  | -            relpath = os.path.relpath(root, base_path) | 
| 22 |  | -            parent = relpath.replace(os.sep, '.').lstrip('.') | 
| 23 |  | -            if relpath != '.' and parent not in found: | 
| 24 |  | -                # foo.bar package but no foo package, skip | 
| 25 |  | -                continue | 
| 26 |  | -            for dir in dirs: | 
| 27 |  | -                if os.path.isfile(os.path.join(root, dir, '__init__.py')): | 
| 28 |  | -                    package = '.'.join((parent, dir)) if parent else dir | 
| 29 |  | -                    found.append(package) | 
| 30 |  | -        return found | 
|  | 8 | +    os.system('{} -m pip install setuptools'.format(sys.executable)) | 
|  | 9 | +    # os.system('{} -m pip install setuptools==79.0.0'.format(sys.executable)) | 
|  | 10 | +    install_setuptools = True | 
|  | 11 | +    try: | 
|  | 12 | +        from setuptools import setup, find_packages | 
|  | 13 | +    except ImportError as e: | 
|  | 14 | +        print('setuptools not found, {}'.format(e)) | 
|  | 15 | +        exit(1) | 
| 31 | 16 | 
 | 
| 32 | 17 | main_ns = {} | 
| 33 |  | -ver_path = convert_path('xarm/version.py') | 
| 34 |  | -with open(os.path.join(os.getcwd(), ver_path)) as ver_file: | 
|  | 18 | +with open(os.path.join(os.getcwd(), 'xarm/version.py')) as ver_file: | 
| 35 | 19 |     exec(ver_file.read(), main_ns) | 
|  | 20 | +    version = main_ns['__version__'] | 
| 36 | 21 | 
 | 
| 37 |  | -version = main_ns['__version__'] | 
| 38 |  | - | 
| 39 |  | -long_description = open('README.rst').read() | 
| 40 |  | -# long_description = 'long description for xArm-Python-SDK' | 
|  | 22 | +long_description = open('README.rst', encoding='utf-8').read() | 
| 41 | 23 | 
 | 
| 42 |  | -try: | 
|  | 24 | +requirements_path = os.path.join(os.getcwd(), 'requirements.txt') | 
|  | 25 | +if os.path.exists(requirements_path): | 
| 43 | 26 |     with open(os.path.join(os.getcwd(), 'requirements.txt')) as f: | 
| 44 | 27 |         requirements = f.read().splitlines() | 
| 45 |  | -except: | 
|  | 28 | +else: | 
| 46 | 29 |     requirements = [] | 
| 47 | 30 | 
 | 
| 48 |  | -setup( | 
| 49 |  | -    name='xArm-Python-SDK', | 
| 50 |  | -    version=version, | 
| 51 |  | -    author='Vinman', | 
| 52 |  | -    description='Python SDK for xArm', | 
| 53 |  | -    packages=find_packages(), | 
| 54 |  | -    author_email='vinman@ufactory.cc', | 
| 55 |  | -    install_requires=requirements, | 
| 56 |  | -    long_description=long_description, | 
| 57 |  | -    license='MIT', | 
| 58 |  | -    zip_safe=False | 
| 59 |  | -) | 
|  | 31 | +try: | 
|  | 32 | +    setup( | 
|  | 33 | +        name='xarm-python-sdk', | 
|  | 34 | +        version=version, | 
|  | 35 | +        author='Vinman', | 
|  | 36 | +        author_email='vinman.wen@ufactory.cc', | 
|  | 37 | +        description='Python SDK for UFACTORY robotic arm 850, xArm 5/6/7, and Lite6.', | 
|  | 38 | +        long_description=long_description, | 
|  | 39 | +        url='https://github.com/xArm-Developer/xArm-Python-SDK', | 
|  | 40 | +        packages=find_packages(), | 
|  | 41 | +        install_requires=requirements, | 
|  | 42 | +        # license='BSD', | 
|  | 43 | +        zip_safe=False, | 
|  | 44 | +        classifiers=[ | 
|  | 45 | +            "Intended Audience :: Developers", | 
|  | 46 | +            "License :: OSI Approved :: BSD License", | 
|  | 47 | +            "Operating System :: OS Independent", | 
|  | 48 | +            "Programming Language :: Python", | 
|  | 49 | +            "Programming Language :: Python :: 3", | 
|  | 50 | +            "Programming Language :: Python :: 3.5", | 
|  | 51 | +            "Programming Language :: Python :: 3.6", | 
|  | 52 | +            "Programming Language :: Python :: 3.7", | 
|  | 53 | +            "Programming Language :: Python :: 3.8", | 
|  | 54 | +            "Programming Language :: Python :: 3.9", | 
|  | 55 | +            "Programming Language :: Python :: 3.10", | 
|  | 56 | +            "Programming Language :: Python :: 3.11", | 
|  | 57 | +            "Programming Language :: Python :: 3.12", | 
|  | 58 | +            "Programming Language :: Python :: 3.13", | 
|  | 59 | +            "Topic :: Software Development", | 
|  | 60 | +        ], | 
|  | 61 | +        python_requires='>=3.5', | 
|  | 62 | +    ) | 
|  | 63 | +except Exception as e: | 
|  | 64 | +    raise e | 
|  | 65 | +finally: | 
|  | 66 | +    if install_setuptools: | 
|  | 67 | +        os.system('{} -m pip uninstall setuptools -y'.format(sys.executable)) | 
0 commit comments