Skip to content

Commit

Permalink
Enforce use of requirements.txt seomoz#34
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Sep 1, 2021
1 parent fa13562 commit 1bcaaa5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 8 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ CLI_ARGS=$1
################################

# Requirement arguments passed to pip and used by default or with --dev.
REQUIREMENTS="--editable ."
DEV_REQUIREMENTS="--editable .[testing]"
REQUIREMENTS="--editable . --constraint requirements.txt"
DEV_REQUIREMENTS="--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"

# where we create a virtualenv
VIRTUALENV_DIR=tmp
Expand All @@ -50,8 +50,12 @@ VIRTUALENV_PYZ_URL=https://bootstrap.pypa.io/virtualenv.pyz
CFG_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CFG_BIN_DIR=$CFG_ROOT_DIR/$VIRTUALENV_DIR/bin

# Find packages from the local thirdparty directory or from pypi
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty"
# Find packages from the local thirdparty directory or from thirdparty.aboutcode.org
PIP_EXTRA_ARGS="--find-links $CFG_ROOT_DIR/thirdparty --find-links https://thirdparty.aboutcode.org/pypi"

if [[ -f "$CFG_ROOT_DIR/requirements.txt" ]] && [[ -f "$CFG_ROOT_DIR/requirements-dev.txt" ]]; then
PIP_EXTRA_ARGS+=" --no-index"
fi

################################
# Set the quiet flag to empty if not defined
Expand Down
11 changes: 8 additions & 3 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
@rem ################################

@rem # Requirement arguments passed to pip and used by default or with --dev.
set "REQUIREMENTS=--editable ."
set "DEV_REQUIREMENTS=--editable .[testing]"
set "REQUIREMENTS=--editable . --constraint requirements.txt"
set "DEV_REQUIREMENTS=--editable .[testing] --constraint requirements.txt --constraint requirements-dev.txt"

@rem # where we create a virtualenv
set "VIRTUALENV_DIR=tmp"
Expand All @@ -49,7 +49,12 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"

@rem ################################
@rem # Thirdparty package locations and index handling
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty"
if exist ""%CFG_ROOT_DIR%\requirements.txt"" if exist ""%CFG_ROOT_DIR%\requirements-dev.txt"" (
set "INDEX_ARG= --no-index"
) else (
set "INDEX_ARG= "
)
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
@rem ################################


Expand Down

0 comments on commit 1bcaaa5

Please sign in to comment.