Skip to content

Commit 5410b6c

Browse files
committed
Setup.py extract version from Autorest generated code
1 parent fe92fe3 commit 5410b6c

File tree

19 files changed

+177
-18
lines changed

19 files changed

+177
-18
lines changed

azure-batch/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/batch/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-batch',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Batch Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-graphrbac/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/graphrbac/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-graphrbac',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Graph RBAC Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-authorization/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/authorization/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-authorization',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Authorization Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-batch/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/batch/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-batch',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Batch Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-cdn/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/cdn/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-cdn',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure CDN Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-cognitiveservices/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/cognitiveservices/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-cognitiveservices',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Cognitive Services Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-commerce/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/commerce/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-commerce',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure commerce Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-compute/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/compute/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-compute',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Compute Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-logic/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/logic/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-logic',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Logic Apps Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-network/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/network/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-network',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Network Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-notificationhubs/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/notificationhubs/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-notificationhubs',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Notification Hubs Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-powerbiembedded/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/powerbiembedded/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-powerbiembedded',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure PowerBI Embedded Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-redis/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/redis/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-redis',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Redis Cache Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

azure-mgmt-resource/azure/mgmt/resource/__init__.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22
from .locks import ManagementLockClient
33
from .policy import PolicyClient
44
from .resources import ResourceManagementClient
5-
from .subscriptions import SubscriptionClient
5+
from .subscriptions import SubscriptionClient
6+
7+
from .version import VERSION
8+
9+
__version__ = VERSION
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VERSION = "0.30.0rc4"

azure-mgmt-resource/setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#--------------------------------------------------------------------------
1717

1818
from setuptools import setup
19+
import re
1920

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

36+
# Version extraction inspired from 'requests'
37+
with open('azure/mgmt/resource/version.py', 'r') as fd:
38+
version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
39+
fd.read(), re.MULTILINE).group(1)
40+
41+
if not version:
42+
raise RuntimeError('Cannot find version information')
43+
3544
setup(
3645
name='azure-mgmt-resource',
37-
version='0.30.0rc4',
46+
version=version,
3847
description='Microsoft Azure Resource Management Client Library for Python',
3948
long_description=open('README.rst', 'r').read(),
4049
license='Apache License 2.0',

0 commit comments

Comments
 (0)