diff --git a/Dockerfile b/Dockerfile index 5d1b37306..3f608b7f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,18 @@ -FROM python:3 +FROM python:3-slim-buster -RUN mkdir -p /src -COPY setup.py /src -COPY doc/CHANGELOG.rst /src -COPY debian/ /src -COPY src/ /src/lib/ +ARG version="master" +ENV PYTHONPATH "/tmp/exabgp/src" -RUN pip install --upgrade pip setuptools -RUN cd /src && pip install . +RUN apt update \ + && apt -y dist-upgrade \ + && rm -rf /var/lib/apt/lists/* /var/cache/apt/* -RUN rm -rf /src +ADD . /tmp/exabgp +WORKDIR /tmp/exabgp +RUN ln -s src/exabgp exabgp -CMD ["exabgp", "--help"] +# RUN python3 -c "import exabgp.application.main; exabgp.application.main.main()" +RUN echo Building exabgp ${version} +RUN pip3 install --upgrade pip setuptools wheel +RUN pip3 install . +WORKDIR /usr/local/etc/exabgp diff --git a/README.md b/README.md index 5e4d2add1..a29937a28 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ It is possible to create a self-contained executable which only requires an inst ``` > cd exabgp-git -> python3 -m zipapp -o /usr/local/sbin/exabgp -m exabgp.application:main -p "/usr/bin/env python3" lib +> python3 -m zipapp -o /usr/local/sbin/exabgp -m exabgp.application:main -p "/usr/bin/env python3" src > /usr/local/sbin/exabgp --version ``` or diff --git a/dev/static/lint b/dev/static/lint index 2a3b25bae..4e9f88be7 100755 --- a/dev/static/lint +++ b/dev/static/lint @@ -1,6 +1,6 @@ #!/bin/sh env \ - PYTHONPATH=$PYTHONPATH:lib \ + PYTHONPATH=$PYTHONPATH:src \ python2.6 \ /opt/local/bin/pylint-2.6 \ --variable-rgx="[a-z_][a-z0-9_]{0,30}$" \ diff --git a/pyproject.toml b/pyproject.toml index e92dea1ad..40144a6d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -84,7 +84,7 @@ show-source = true max-complexity = 18 statistics = true -exclude = '.git,.tox,__pycache__,build,dist,tests/*,lib/exabgp/vendoring/*,' +exclude = '.git,.tox,__pycache__,build,dist,tests/*,src/exabgp/vendoring/*,' select = 'B,C,E,F,W,T4,B9' # E222 multiple spaces after operator diff --git a/qa/bin/functional b/qa/bin/functional index 81e35c952..8ae8fa6b0 100755 --- a/qa/bin/functional +++ b/qa/bin/functional @@ -20,7 +20,7 @@ import subprocess PROGRAM = os.path.realpath(__file__) ROOT = os.path.abspath(os.path.join(os.path.dirname(PROGRAM), os.path.join('..', '..'))) -LIBRARY = os.path.join(ROOT, 'lib') +LIBRARY = os.path.join(ROOT, 'src') EXPLAIN = """ ExaBGP command line diff --git a/qa/scrutinizer.yml b/qa/scrutinizer.yml index 1e2854c83..a6ef284f6 100644 --- a/qa/scrutinizer.yml +++ b/qa/scrutinizer.yml @@ -11,7 +11,7 @@ filter: - 'doc/*' - 'etc/*' - 'fifo/*' - - 'lib/exabgp/vendoring/*' + - 'src/exabgp/vendoring/*' - 'logo/*' - 'qa/*' - 'redhat/*' @@ -39,7 +39,7 @@ tools: - 'doc/*' - 'etc/*' - 'fifo/*' - - 'lib/exabgp/vendoring/*' + - 'src/exabgp/vendoring/*' - 'logo/*' - 'qa/*' - 'redhat/*' @@ -62,7 +62,7 @@ tools: - 'doc/*' - 'etc/*' - 'fifo/*' - - 'lib/exabgp/vendoring/*' + - 'src/exabgp/vendoring/*' - 'logo/*' - 'qa/*' - 'redhat/*' diff --git a/setup.cfg b/setup.cfg index e43a83388..664636a57 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,12 +25,12 @@ zip_safe = False include_package_data = True packages = find: package_dir= - =lib + =src install_requires = setuptools [options.packages.find] -where = lib +where = src exclude = [options.entry_points] diff --git a/setup.py b/setup.py index 416eba0d3..8c46af4e0 100644 --- a/setup.py +++ b/setup.py @@ -14,15 +14,15 @@ from distutils.core import setup -# less magic for readers than adding lib/exabgp to sys.path and using importlib +# less magic for readers than adding src/exabgp to sys.path and using importlib -get_version = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'lib/exabgp/version.py') +get_version = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'src/exabgp/version.py') version = os.popen(f'{sys.executable} {get_version}').read() # without this sys.path change then this does fail # sudo -H pip install git+https://github.com/Exa-Networks/exabgp.git -sys.path.append(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'lib')) +sys.path.append(os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'src')) def filesOf(directory): diff --git a/src/exabgp/environment/parsing.py b/src/exabgp/environment/parsing.py index c10400d3f..389787e8c 100644 --- a/src/exabgp/environment/parsing.py +++ b/src/exabgp/environment/parsing.py @@ -109,7 +109,7 @@ def folder(path): def path(path): - split = sys.argv[0].split('lib/exabgp') + split = sys.argv[0].split('src/exabgp') if len(split) > 1: prefix = os.sep.join(split[:1]) if prefix and path.startswith(prefix): @@ -169,7 +169,7 @@ def root(path): roots = base.root.split(os.sep) location = [] for index in range(len(roots) - 1, -1, -1): - if roots[index] == 'lib': + if roots[index] == 'src': if index: location = roots[:index] break