Skip to content

Commit

Permalink
Update for license header
Browse files Browse the repository at this point in the history
Signed-off-by: pem70 <[email protected]>
  • Loading branch information
pem70 committed Jul 18, 2024
1 parent 6b9c00f commit 2dbb721
Show file tree
Hide file tree
Showing 22 changed files with 267 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/sdk-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
run: pydoclint --exclude='.*/build/.*' src
- name: Lint with pylint
run: pylint src --disable=all --enable=C0103 --ignore=build
- name: Check and add license headers
run: python scripts/license_header.py src
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil

- *Breaking*: Revised function names in `Logger` class and `files` class into snake_case. Supported for function case enforcer [#315] (https://github.com/zowe/zowe-client-python-sdk/issues/315)

- Added checks and auto addition for license headers on workflow. [#293] (https://github.com/zowe/zowe-client-python-sdk/issues/293)

### Bug Fixes

- Fixed a bug on `create` in `Datasets` where the target dataset gets created with a different block size when `like` is specified [#295] (https://github.com/zowe/zowe-client-python-sdk/issues/295)
Expand Down
54 changes: 54 additions & 0 deletions scripts/license_header.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import os
import sys

# Define the license header you expect in each file
LICENSE_HEADER = '''"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""'''


def check_and_add_license_header(file_path):
with open(file_path, "r+", encoding="utf-8") as file:
content = file.read()
if LICENSE_HEADER not in content:
print(f"Adding license header to: {file_path}")
file.seek(0, 0)
file.write(LICENSE_HEADER + "\n" + content)
return False
return True


def main():
if len(sys.argv) != 2:
print("Usage: python check_license_header.py <directory>")
sys.exit(1)

directory = sys.argv[1]
all_files_passed = True

for root, _, files in os.walk(directory):
if "build" in root.split(os.path.sep):
continue
for file in files:
if file.endswith(".py"):
file_path = os.path.join(root, file)
if not check_and_add_license_header(file_path):
print(f"License header missing in: {file_path}")
all_files_passed = False

if not all_files_passed:
sys.exit(1)
else:
print("All files have the correct license header.")


if __name__ == "__main__":
main()
11 changes: 11 additions & 0 deletions src/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
__version__ = "1.0.0.dev17"
11 changes: 11 additions & 0 deletions src/core/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import sys

from setuptools import find_namespace_packages, setup
Expand Down
11 changes: 11 additions & 0 deletions src/core/zowe/core_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - Core package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/core/zowe/core_for_zowe_sdk/custom_warnings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""A public module for custom warnings."""


Expand Down
11 changes: 11 additions & 0 deletions src/core/zowe/core_for_zowe_sdk/logger.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Logger module for handling application logging.
Expand Down
11 changes: 11 additions & 0 deletions src/secrets/zowe/secrets_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - Client Secrets package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import os.path
import uuid

Expand Down
11 changes: 11 additions & 0 deletions src/zos_console/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import sys

from setuptools import find_namespace_packages, setup
Expand Down
11 changes: 11 additions & 0 deletions src/zos_console/zowe/zos_console_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - z/OS Console package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/zos_console/zowe/zos_console_for_zowe_sdk/console.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""Public module for class Console."""

from typing import Optional
Expand Down
11 changes: 11 additions & 0 deletions src/zos_files/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import sys

from setuptools import find_namespace_packages, setup
Expand Down
11 changes: 11 additions & 0 deletions src/zos_files/zowe/zos_files_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - z/OS Files package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/zos_jobs/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import sys

from setuptools import find_namespace_packages, setup
Expand Down
11 changes: 11 additions & 0 deletions src/zos_jobs/zowe/zos_jobs_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - z/OS Jobs package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/zos_tso/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import sys

from setuptools import find_namespace_packages, setup
Expand Down
11 changes: 11 additions & 0 deletions src/zos_tso/zowe/zos_tso_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - z/OS TSO package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/zosmf/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
import sys

from setuptools import find_namespace_packages, setup
Expand Down
11 changes: 11 additions & 0 deletions src/zosmf/zowe/zosmf_for_zowe_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""
Zowe Python SDK - z/OSMF package
"""
Expand Down
11 changes: 11 additions & 0 deletions src/zosmf/zowe/zosmf_for_zowe_sdk/zosmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe Project.
"""
"""Zowe Python Client SDK.
This program and the accompanying materials are made available under the terms of the
Eclipse Public License v2.0 which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-v20.html
SPDX-License-Identifier: EPL-2.0
Copyright Contributors to the Zowe project.
"""

Expand Down

0 comments on commit 2dbb721

Please sign in to comment.