1#!/usr/bin/env python 2 3#------------------------------------------------------------------------- 4# Copyright (c) Microsoft Corporation. All rights reserved. 5# Licensed under the MIT License. See License.txt in the project root for 6# license information. 7#-------------------------------------------------------------------------- 8 9import re 10import os.path 11from io import open 12from setuptools import find_packages, setup 13 14# Change the PACKAGE_NAME only to change folder and different name 15PACKAGE_NAME = "azure-mgmt-batch" 16PACKAGE_PPRINT_NAME = "Batch Management" 17 18# a-b-c => a/b/c 19package_folder_path = PACKAGE_NAME.replace('-', '/') 20# a-b-c => a.b.c 21namespace_name = PACKAGE_NAME.replace('-', '.') 22 23# azure v0.x is not compatible with this package 24# azure v0.x used to have a __version__ attribute (newer versions don't) 25try: 26 import azure 27 try: 28 ver = azure.__version__ 29 raise Exception( 30 'This package is incompatible with azure=={}. '.format(ver) + 31 'Uninstall it with "pip uninstall azure".' 32 ) 33 except AttributeError: 34 pass 35except ImportError: 36 pass 37 38# Version extraction inspired from 'requests' 39with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: 40 version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', 41 fd.read(), re.MULTILINE).group(1) 42 43if not version: 44 raise RuntimeError('Cannot find version information') 45 46with open('README.md', encoding='utf-8') as f: 47 readme = f.read() 48with open('CHANGELOG.md', encoding='utf-8') as f: 49 changelog = f.read() 50 51setup( 52 name=PACKAGE_NAME, 53 version=version, 54 description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), 55 long_description=readme + '\n\n' + changelog, 56 long_description_content_type='text/markdown', 57 license='MIT License', 58 author='Microsoft Corporation', 59 author_email='azpysdkhelp@microsoft.com', 60 url='https://github.com/Azure/azure-sdk-for-python', 61 classifiers=[ 62 'Development Status :: 5 - Production/Stable', 63 'Programming Language :: Python', 64 'Programming Language :: Python :: 2', 65 'Programming Language :: Python :: 2.7', 66 'Programming Language :: Python :: 3', 67 'Programming Language :: Python :: 3.4', 68 'Programming Language :: Python :: 3.5', 69 'Programming Language :: Python :: 3.6', 70 'Programming Language :: Python :: 3.7', 71 'License :: OSI Approved :: MIT License', 72 ], 73 zip_safe=False, 74 packages=find_packages(exclude=[ 75 'tests', 76 # Exclude packages that will be covered by PEP420 or nspkg 77 'azure', 78 'azure.mgmt', 79 ]), 80 install_requires=[ 81 'msrest>=0.6.21', 82 'azure-common~=1.1', 83 'azure-mgmt-core>=1.2.0,<2.0.0', 84 ], 85 extras_require={ 86 ":python_version<'3.0'": ['azure-mgmt-nspkg'], 87 } 88) 89