Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1b6c7fa
Add backend build system to support source builds
stealthycoin Oct 20, 2022
10ce2b1
Add tests/ directory to the source distribution
stealthycoin Oct 20, 2022
328dee5
Add flags to test scripts to allow intalling and running from another…
stealthycoin Oct 21, 2022
4973449
Add missing files needed to run backend tests to the sdist
stealthycoin Oct 22, 2022
879ee2e
Add test to ensure that the lock files are up to date
stealthycoin Jan 6, 2023
f0a98ba
Add script to regenerate configure file
stealthycoin Jan 13, 2023
faab84c
Update source distribution proposal
stealthycoin Jan 17, 2023
a3c7526
Update --with-download-deps help
stealthycoin Jan 18, 2023
ae715c9
Make regenerate-configure script work in more environments
stealthycoin Jan 24, 2023
71f998b
Regenerate lockfiles
stealthycoin Jan 31, 2023
60133e3
Fix tests for updated mock/pbr/pytest
stealthycoin Feb 6, 2023
e13dacd
Update metadata distribution field
stealthycoin Oct 24, 2022
4da0f80
Fix alpine sdist example
stealthycoin Jan 31, 2023
1c456c8
Regenerate lockfiles for awscrt bump
stealthycoin Feb 8, 2023
df11ac2
Add a pip install command to the error ouput with unmet dependencies
stealthycoin Feb 1, 2023
a9e73c2
Bump flit core to <3.8.1
stealthycoin Feb 9, 2023
6a20f79
Add --prefer-binary to environment validation output
stealthycoin Feb 10, 2023
12d1742
Validate that Python was compiled with sqlite3
stealthycoin Jan 30, 2023
f9c7813
Add error message when flit_core is not installed
stealthycoin Feb 14, 2023
3ffd858
Merge pull request #7664 from stealthycoin/missing-flit-core
stealthycoin Feb 14, 2023
79666d9
Update configure to match current v2 version
stealthycoin Feb 14, 2023
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
5 changes: 5 additions & 0 deletions .changes/next-release/feature-SourceDistribution-54150.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "feature",
"category": "Source Distribution",
"description": "Add supported autotools interface for building from source."
}
33 changes: 33 additions & 0 deletions .github/workflows/source-dist-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

name: Run source distribution tests

on:
push:
pull_request:
branches-ignore: [ master ]

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python scripts/ci/install
python scripts/ci/install-build-system
python -m pip freeze --all
- name: Run build-system tests
run: |
pip uninstall -y awscli
python scripts/ci/run-build-system-tests
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,27 @@ dist/

# autocomplete index
awscli/data/ac.index

# Build system files
Makefile
config.log
config.status

# autoconf
autom4te.cache
/autoscan.log
/autoscan-*.log
/aclocal.m4
/compile
/config.cache
/config.guess
/config.h.in
/config.log
/config.status
/config.sub
/configure
/configure.scan
/depcomp
/install-sh
/missing
/stamp-h1
41 changes: 41 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
aws_cli_builddir = $(builddir)/build
build_backend = $(srcdir)/backends/build_system

builddir = @builddir@
srcdir = @srcdir@
VPATH = @srcdir@

PYTHON = @PYTHON@

INSTALL_TYPE = @INSTALL_TYPE@
DOWNLOAD_DEPS_FLAG = @DOWNLOAD_DEPS_FLAG@

all: build

build:
"$(PYTHON)" "$(build_backend)" \
build \
--artifact "$(INSTALL_TYPE)" \
--build-dir "$(aws_cli_builddir)" $(DOWNLOAD_DEPS_FLAG)

clean:
rm -rf "$(aws_cli_builddir)"

install:
"$(PYTHON)" "$(build_backend)" \
install \
--build-dir "$(aws_cli_builddir)" \
--lib-dir "$(DESTDIR)$(libdir)" \
--bin-dir "$(DESTDIR)$(bindir)"

uninstall:
"$(PYTHON)" "$(build_backend)" \
uninstall \
--lib-dir "$(DESTDIR)$(libdir)" \
--bin-dir "$(DESTDIR)$(bindir)"

.PHONY: all build install uninstall
12 changes: 12 additions & 0 deletions backends/build_system/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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.
125 changes: 125 additions & 0 deletions backends/build_system/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file 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.
import argparse
import os
import shutil
from awscli_venv import AwsCliVenv
from constants import (
ArtifactType,
BUILD_DIR,
INSTALL_DIRNAME,
)
from exe import ExeBuilder
from install import (
Installer,
Uninstaller,
)
from validate_env import validate_env


def create_exe(aws_venv, build_dir):
exe_workspace = os.path.join(build_dir, "exe")
if os.path.exists(exe_workspace):
shutil.rmtree(exe_workspace)
builder = ExeBuilder(exe_workspace, aws_venv)
builder.build()


def build(parsed_args):
aws_venv = _bootstap_venv(
parsed_args.build_dir,
parsed_args.artifact,
parsed_args.download_deps,
)
if parsed_args.artifact == ArtifactType.PORTABLE_EXE.value:
create_exe(aws_venv, parsed_args.build_dir)


def validate(parsed_args):
validate_env(parsed_args.artifact)


def install(parsed_args):
build_dir = parsed_args.build_dir
install_dir = os.path.join(parsed_args.lib_dir, INSTALL_DIRNAME)
bin_dir = parsed_args.bin_dir
installer = Installer(build_dir)
installer.install(install_dir, bin_dir)


def uninstall(parsed_args):
install_dir = os.path.join(parsed_args.lib_dir, INSTALL_DIRNAME)
bin_dir = parsed_args.bin_dir
uninstaller = Uninstaller()
uninstaller.uninstall(install_dir, bin_dir)


def _bootstap_venv(build_dir: str, artifact_type: str, download_deps: bool):
venv_path = os.path.join(build_dir, "venv")
if os.path.exists(venv_path):
shutil.rmtree(venv_path)
os.makedirs(venv_path)
aws_venv = AwsCliVenv(venv_path)
aws_venv.create()
aws_venv.bootstrap(artifact_type, download_deps)
return aws_venv


def main():
parser = argparse.ArgumentParser()

subparser = parser.add_subparsers()

validate_env_parser = subparser.add_parser("validate-env")
validate_env_parser.add_argument(
"--artifact", choices=[e.value for e in ArtifactType], required=True
)
validate_env_parser.set_defaults(func=validate)

build_parser = subparser.add_parser("build")
build_parser.add_argument(
"--artifact", choices=[e.value for e in ArtifactType], required=True
)
build_parser.add_argument(
"--build-dir", default=BUILD_DIR, type=os.path.abspath
)
build_parser.add_argument("--download-deps", action="store_true")
build_parser.set_defaults(func=build)

install_parser = subparser.add_parser("install")
install_parser.add_argument(
"--build-dir", default=BUILD_DIR, type=os.path.abspath
)
install_parser.add_argument(
"--lib-dir", required=True, type=os.path.abspath
)
install_parser.add_argument(
"--bin-dir", required=True, type=os.path.abspath
)
install_parser.set_defaults(func=install)

uninstall_parser = subparser.add_parser("uninstall")
uninstall_parser.add_argument(
"--lib-dir", required=True, type=os.path.abspath
)
uninstall_parser.add_argument(
"--bin-dir", required=True, type=os.path.abspath
)
uninstall_parser.set_defaults(func=uninstall)

parsed_args = parser.parse_args()
parsed_args.func(parsed_args)


if __name__ == "__main__":
main()
Loading