From 6161387f6af71904c06c98fe305649075056480a Mon Sep 17 00:00:00 2001 From: Norberto Arrieta Date: Fri, 14 Dec 2018 09:17:48 -0800 Subject: [PATCH] Add __main__ module to Python's egg (#1418) * Revert "Remove __main__ module" (commit a85e6cd2d21450bf98bcee88e52d396aec58035f). * Add __main__ to Python's egg --- __main__.py | 20 ++++++++++++++++++++ setup.py | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 __main__.py diff --git a/__main__.py b/__main__.py new file mode 100644 index 0000000000..087b4080fc --- /dev/null +++ b/__main__.py @@ -0,0 +1,20 @@ +# Copyright 2018 Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Requires Python 2.6+ and Openssl 1.0+ +# + +import azurelinuxagent.agent as agent + +agent.main() diff --git a/setup.py b/setup.py index c24180d253..301df01d59 100755 --- a/setup.py +++ b/setup.py @@ -221,6 +221,11 @@ def run(self): if float(sys.version[:3]) >= 3.7: requires = ['distro'] +modules = [] + +if "bdist_egg" in sys.argv: + modules.append("__main__") + setuptools.setup( name=AGENT_NAME, version=AGENT_VERSION, @@ -231,6 +236,7 @@ def run(self): url='https://github.com/Azure/WALinuxAgent', license='Apache License Version 2.0', packages=find_packages(exclude=["tests*"]), + py_modules=modules, install_requires=requires, cmdclass={ 'install': install