Commit ffb483fa authored by Lukas Vik's avatar Lukas Vik
Browse files

Add files missing in release

parent 461dc105
Pipeline #332272851 passed with stages
in 9 minutes and 2 seconds
......@@ -79,6 +79,7 @@ build_pypi:
script:
- apt-get update -qq > /dev/null
- apt-get install -y -qq git > /dev/null
- python3 -m pip install GitPython tomlkit > /dev/null
- python3 setup.py sdist
artifacts:
paths:
......
......@@ -14,8 +14,10 @@ from setuptools import setup, find_packages
REPO_ROOT = Path(__file__).parent
sys.path.insert(0, str(REPO_ROOT))
import tsfpga
from tsfpga.about import get_slogan
from tsfpga.git_utils import find_git_files
from tsfpga.system_utils import read_file
......@@ -68,21 +70,29 @@ def read_requirements_file(path):
def get_package_data():
"""
Additional files that shall be included in the release, apart from the python packages
Additional files that shall be included in the release, apart from the python packages.
All python files are included as packages by the find_packages() call as long as they have
an __init__.py file in the folder. Include all other files from the repo as package data.
This includes non-python files as well as python files that are not part of a package (such
as various module_*.py, etc).
"""
non_python_files = list(find_git_files(tsfpga.REPO_ROOT, file_endings_avoid=".py"))
all_python_files = find_git_files(tsfpga.REPO_ROOT, file_endings_include=".py")
non_package_python_files = []
for python_file in all_python_files:
if not (python_file.parent / "__init__.py").exists():
non_package_python_files.append(python_file)
package_data = non_python_files + non_package_python_files
# Specify path relative to the tsfpga python package folder
tsfpga_package_root = REPO_ROOT / "tsfpga"
package_data = [
README_RST,
REQUIREMENTS_TXT,
REQUIREMENTS_DEVELOP_TXT,
tsfpga.TSFPGA_PATH / "test" / "lint" / "pylintrc",
tsfpga.TSFPGA_PATH / "test" / "lint" / "pycodestylerc",
path_relative_to_str(file_path, tsfpga_package_root) for file_path in package_data
]
package_data += find_package_files(tsfpga.TSFPGA_TCL)
package_data += find_package_files(tsfpga.TSFPGA_MODULES)
# Specify path relative to the tsfpga python package folder
tsfpga_root = Path(REPO_ROOT, "tsfpga")
package_data = [path_relative_to_str(file, tsfpga_root) for file in package_data]
return package_data
......@@ -94,16 +104,5 @@ def path_relative_to_str(path, other):
return relpath(str(path), str(other))
def find_package_files(directory):
"""
Find files to include in the package, ignoring temporary files.
"""
files = []
for file in directory.glob("**/*"):
if not file.suffix.endswith("pyc"):
files.append(file)
return files
if __name__ == "__main__":
main()
# --------------------------------------------------------------------------------------------------
# Copyright (c) Lukas Vik. All rights reserved.
#
# This file is part of the tsfpga project.
# https://tsfpga.com
# https://gitlab.com/tsfpga/tsfpga
# --------------------------------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------------
# Copyright (c) Lukas Vik. All rights reserved.
#
# This file is part of the tsfpga project.
# https://tsfpga.com
# https://gitlab.com/tsfpga/tsfpga
# --------------------------------------------------------------------------------------------------
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment