Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions azure-mgmt-datalake-nspkg/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This is the Microsoft Azure Data Lake Management namespace package.

This package is not intended to be installed directly by the end user.

Since version 3.0, this is Python 2 package only, Python 3.x SDKs will use `PEP420 <https://www.python.org/dev/peps/pep-0420/>` as namespace package strategy.
This package will use `python_requires` to enforce Python 2 installation. This implies that you might see this package on Python 3 environment if you have pip < 9.0 or setuptools < 24.2.0.

It provides the necessary files for other packages to extend the azure.mgmt.datalake namespace.

If you are looking to install the Azure client libraries, see the
Expand Down
1 change: 1 addition & 0 deletions azure-mgmt-datalake-nspkg/azure/mgmt/datalake/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
12 changes: 4 additions & 8 deletions azure-mgmt-datalake-nspkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,28 @@

setup(
name='azure-mgmt-datalake-nspkg',
version='2.0.0',
version='3.0.0',
description='Microsoft Azure Data Lake Management Namespace Package [Internal]',
long_description=open('README.rst', 'r').read(),
license='MIT License',
author='Microsoft Corporation',
author_email='ptvshelp@microsoft.com',
author_email='azpysdkhelp@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',
],
python_requires='<3',
zip_safe=False,
packages=[
'azure',
'azure.mgmt',
'azure.mgmt.datalake',
],
install_requires=[
'azure-mgmt-nspkg>=2.0.0',
'azure-mgmt-nspkg>=3.0.0',
],
)
3 changes: 3 additions & 0 deletions azure-mgmt-nspkg/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This is the Microsoft Azure Management namespace package.

This package is not intended to be installed directly by the end user.

Since version 3.0, this is Python 2 package only, Python 3.x SDKs will use `PEP420 <https://www.python.org/dev/peps/pep-0420/>` as namespace package strategy.
This package will use `python_requires` to enforce Python 2 installation. This implies that you might see this package on Python 3 environment if you have pip < 9.0 or setuptools < 24.2.0.

It provides the necessary files for other packages to extend the azure.mgmt namespace.

If you are looking to install the Azure client libraries, see the
Expand Down
1 change: 1 addition & 0 deletions azure-mgmt-nspkg/azure/mgmt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
12 changes: 4 additions & 8 deletions azure-mgmt-nspkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,27 @@

setup(
name='azure-mgmt-nspkg',
version='2.0.0',
version='3.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',
author_email='azpysdkhelp@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',
],
python_requires='<3',
install_requires=[
'azure-nspkg>=2.0.0',
'azure-nspkg>=3.0.0',
]
)
1 change: 1 addition & 0 deletions azure-nspkg/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include *.rst
3 changes: 3 additions & 0 deletions azure-nspkg/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This is the Microsoft Azure namespace package.

This package is not intended to be installed directly by the end user.

Since version 3.0, this is Python 2 package only, Python 3.x SDKs will use `PEP420 <https://www.python.org/dev/peps/pep-0420/>` as namespace package strategy.
This package will use `python_requires` to enforce Python 2 installation. This implies that you might see this package on Python 3 environment if you have pip < 9.0 or setuptools < 24.2.0.

It provides the necessary files for other packages to extend the azure namespace.

If you are looking to install the Azure client libraries, see the
Expand Down
2 changes: 1 addition & 1 deletion azure-nspkg/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@

__path__ = __import__('pkgutil').extend_path(__path__, __name__)
10 changes: 3 additions & 7 deletions azure-nspkg/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,21 @@

setup(
name='azure-nspkg',
version='2.0.0',
version='3.0.0',
description='Microsoft Azure Namespace Package [Internal]',
long_description=open('README.rst', 'r').read(),
license='MIT License',
author='Microsoft Corporation',
author_email='ptvshelp@microsoft.com',
author_email='azpysdkhelp@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',
],
python_requires='<3',
zip_safe=False,
packages=[
'azure',
Expand Down
21 changes: 17 additions & 4 deletions azure-sdk-tools/packaging_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from contextlib import suppress
import logging
import os
from pathlib import Path
Expand All @@ -23,10 +24,20 @@ def build_config(config : Dict[str, Any]) -> Dict[str, str]:
result["classifier"] = "Development Status :: 4 - Beta"
# Manage the nspkg
package_name = result["package_name"]
result["package_nspkg"] = package_name[:package_name.rindex('-')]+"-nspkg"
result["package_nspkg"] = result.pop(
"package_nspkg",
package_name[:package_name.rindex('-')]+"-nspkg"
)
# ARM?
result['is_arm'] = result.pop("is_arm", True)

# Pre-compute some Jinja variable that are complicated to do inside the templates
package_parts = result["package_nspkg"][:-len('-nspkg')].split('-')
result['nspkg_names'] = [
".".join(package_parts[:i+1])
for i in range(len(package_parts))
]

# Return result
return result

Expand Down Expand Up @@ -86,21 +97,23 @@ def build_packaging_by_package_name(package_name: str, output_folder: str, build

# __init__.py is a weird one
if template_name == "__init__.py":
split_package_name = package_name.split("-")
split_package_name = package_name.split("-")[:-1]
for i in range(len(split_package_name)):
init_path = Path(output_folder).joinpath(
package_name,
*split_package_name[:i+1],
template_name
)
if init_path.exists():
break
with open(init_path, "w") as fd:
fd.write(result)

continue

with open(future_filepath, "w") as fd:
fd.write(result)
# azure_bdist_wheel had been removed, but need to delete it manually
with suppress(FileNotFoundError):
(Path(output_folder) / package_name / "azure_bdist_wheel.py").unlink()


_LOGGER.info("Template done %s", package_name)
2 changes: 2 additions & 0 deletions azure-sdk-tools/packaging_tools/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# Default conf
_CONFIG = {
"package_name": "packagename",
"package_nspkg": "packagenspkg",
"package_pprint_name": "MyService Management",
"package_doc_id": "",
"is_stable": False,
Expand All @@ -35,6 +36,7 @@ def build_default_conf(folder: Path, package_name: str) -> None:
_LOGGER.info("Build default conf for %s", package_name)
conf = {_SECTION: _CONFIG.copy()}
conf[_SECTION]["package_name"] = package_name
conf[_SECTION]["package_nspkg"] = package_name[:package_name.rindex('-')]+"-nspkg"

with open(conf_path, "w") as fd:
toml.dump(conf, fd)
1 change: 0 additions & 1 deletion azure-sdk-tools/packaging_tools/templates/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
include *.rst
include azure_bdist_wheel.py
2 changes: 1 addition & 1 deletion azure-sdk-tools/packaging_tools/templates/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
54 changes: 0 additions & 54 deletions azure-sdk-tools/packaging_tools/templates/azure_bdist_wheel.py

This file was deleted.

1 change: 0 additions & 1 deletion azure-sdk-tools/packaging_tools/templates/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[bdist_wheel]
universal=1
azure-namespace-package={{package_nspkg}}
18 changes: 10 additions & 8 deletions azure-sdk-tools/packaging_tools/templates/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@
import os.path
from io import open
from setuptools import find_packages, setup
try:
from azure_bdist_wheel import cmdclass
except ImportError:
from distutils import log as logger
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}

# Change the PACKAGE_NAME only to change folder and different name
PACKAGE_NAME = "{{package_name}}"
Expand Down Expand Up @@ -76,11 +70,19 @@
'License :: OSI Approved :: MIT License',
],
zip_safe=False,
packages=find_packages(exclude=["tests"]),
packages=find_packages(exclude=[
'tests',
# Exclude packages that will be covered by PEP420 or nspkg
{%- for nspkg_name in nspkg_names %}
'{{ nspkg_name }}',
{%- endfor %}
]),
install_requires=[
'msrest>=0.5.0',
'msrestazure>=0.4.32,<2.0.0',
'azure-common~=1.1',
],
cmdclass=cmdclass
extras_require={
":python_version<'3.0'": ['{{package_nspkg}}'],
}
)
16 changes: 10 additions & 6 deletions scripts/dev_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def pip_command(command):
nspkg_packages = [p for p in packages if "nspkg" in p]
nspkg_packages.sort(key = lambda x: len([c for c in x if c == '-']))

# Consider "azure-common" as a power nspkg : has to be installed after nspkg
nspkg_packages.append("azure-common")

# Manually push meta-packages at the end, in reverse dependency order
meta_packages = ['azure-mgmt', 'azure']

content_packages = [p for p in packages if p not in nspkg_packages+meta_packages]
# Put azure-common in front
content_packages.remove("azure-common")
content_packages.insert(0, "azure-common")

print('Running dev setup...')
print('Root directory \'{}\'\n'.format(root_dir))
Expand All @@ -47,11 +47,15 @@ def pip_command(command):
whl_list = ' '.join([os.path.join(privates_dir, f) for f in os.listdir(privates_dir)])
pip_command('install {}'.format(whl_list))

# install packages
for package_list in [nspkg_packages, content_packages]:
for package_name in package_list:
# install nspkg only on py2
if sys.version_info < (3, ):
for package_name in nspkg_packages:
pip_command('install -e {}'.format(package_name))

# install packages
for package_name in content_packages:
pip_command('install -e {}'.format(package_name))

# Ensure that the site package's azure/__init__.py has the old style namespace
# package declaration by installing the old namespace package
pip_command('install --force-reinstall azure-mgmt-nspkg==1.0.0')
Expand Down