Skip to content

Commit

Permalink
Setup.py extract version from Autorest generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Jun 23, 2016
1 parent fe92fe3 commit 5410b6c
Show file tree
Hide file tree
Showing 19 changed files with 177 additions and 18 deletions.
11 changes: 10 additions & 1 deletion azure-batch/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/batch/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-batch',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Batch Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-graphrbac/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/graphrbac/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-graphrbac',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Graph RBAC Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-authorization/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/authorization/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-authorization',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Authorization Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-batch/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/batch/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-batch',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Batch Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-cdn/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/cdn/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-cdn',
version='0.30.0rc4',
version=version,
description='Microsoft Azure CDN Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-cognitiveservices/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/cognitiveservices/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-cognitiveservices',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Cognitive Services Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-commerce/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/commerce/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-commerce',
version='0.30.0rc4',
version=version,
description='Microsoft Azure commerce Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-compute/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/compute/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-compute',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Compute Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-logic/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/logic/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-logic',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Logic Apps Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-network/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/network/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-network',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Network Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-notificationhubs/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/notificationhubs/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-notificationhubs',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Notification Hubs Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-powerbiembedded/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/powerbiembedded/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-powerbiembedded',
version='0.30.0rc4',
version=version,
description='Microsoft Azure PowerBI Embedded Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
11 changes: 10 additions & 1 deletion azure-mgmt-redis/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/redis/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-redis',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Redis Cache Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
7 changes: 6 additions & 1 deletion azure-mgmt-resource/azure/mgmt/resource/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
from .locks import ManagementLockClient
from .policy import PolicyClient
from .resources import ResourceManagementClient
from .subscriptions import SubscriptionClient
from .subscriptions import SubscriptionClient

from .version import VERSION

__version__ = VERSION

1 change: 1 addition & 0 deletions azure-mgmt-resource/azure/mgmt/resource/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = "0.30.0rc4"
11 changes: 10 additions & 1 deletion azure-mgmt-resource/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#--------------------------------------------------------------------------

from setuptools import setup
import re

# azure v0.x is not compatible with this package
# azure v0.x used to have a __version__ attribute (newer versions don't)
Expand All @@ -32,9 +33,17 @@
except ImportError:
pass

# Version extraction inspired from 'requests'
with open('azure/mgmt/resource/version.py', 'r') as fd:
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)

if not version:
raise RuntimeError('Cannot find version information')

setup(
name='azure-mgmt-resource',
version='0.30.0rc4',
version=version,
description='Microsoft Azure Resource Management Client Library for Python',
long_description=open('README.rst', 'r').read(),
license='Apache License 2.0',
Expand Down
Loading

0 comments on commit 5410b6c

Please sign in to comment.