Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Created March 23, 2017 19:59
Show Gist options
  • Save lmazuel/02e4e9fbb96abed9bdef9db99bd80403 to your computer and use it in GitHub Desktop.
Save lmazuel/02e4e9fbb96abed9bdef9db99bd80403 to your computer and use it in GitHub Desktop.
Wheel override proto
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#--------------------------------------------------------------------------
from setuptools import setup
from distutils import log as logger
import os.path
try:
from wheel.bdist_wheel import bdist_wheel
class _bdist_wheel(bdist_wheel):
def write_record(self, bdist_dir, distinfo_dir):
logger.info("manually remove azure/__init__.py while building a wheel")
azure_init_file = os.path.join(bdist_dir, 'azure/__init__.py')
if os.path.isfile(azure_init_file):
os.remove(azure_init_file)
bdist_wheel.write_record(self, bdist_dir, distinfo_dir)
cmdclass = {
'bdist_wheel': _bdist_wheel,
}
except ImportError:
logger.warning("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}
# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
try:
import azure
try:
ver = azure.__version__
raise Exception(
'This package is incompatible with azure=={}. '.format(ver) +
'Uninstall it with "pip uninstall azure".'
)
except AttributeError:
pass
except ImportError:
pass
setup(
name='azure-mgmt-nspkg',
version='2.0.0',
description='Microsoft Azure Resource Management Namespace Package [Internal]',
long_description=open('README.rst', 'r').read(),
license='MIT License',
author='Microsoft Corporation',
author_email='ptvshelp@microsoft.com',
url='https://github.com/Azure/azure-sdk-for-python',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
packages=[
'azure',
'azure.mgmt',
],
install_requires=[
'azure-nspkg',
],
cmdclass=cmdclass,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment