mirror of
https://github.com/ansible/awx.git
synced 2026-02-01 01:28:09 -03:30
Automatically install setuptools-scm in script called from Makefile
This commit is contained in:
@@ -5,15 +5,16 @@
|
||||
tasks:
|
||||
- name: Get version from SCM if not explicitly provided
|
||||
shell: |
|
||||
python3 -m setuptools_scm | cut -d + -f -1
|
||||
make print-VERSION | cut -d + -f -1
|
||||
args:
|
||||
chdir: '../../'
|
||||
register: setup_py_version
|
||||
register: scm_version
|
||||
failed_when: not scm_version.stdout
|
||||
when: awx_version is not defined
|
||||
|
||||
- name: Set awx_version
|
||||
set_fact:
|
||||
awx_version: "{{ setup_py_version.stdout }}"
|
||||
awx_version: "{{ scm_version.stdout }}"
|
||||
when: awx_version is not defined
|
||||
|
||||
- include_role:
|
||||
|
||||
@@ -43,7 +43,7 @@ RUN dnf -y update && dnf install -y 'dnf-command(config-manager)' && \
|
||||
xmlsec1-devel \
|
||||
xmlsec1-openssl-devel
|
||||
|
||||
RUN pip3 install virtualenv setuptools_scm build
|
||||
RUN pip3 install virtualenv build
|
||||
|
||||
|
||||
# Install & build requirements
|
||||
|
||||
@@ -1,4 +1,18 @@
|
||||
from setuptools_scm import get_version
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import traceback
|
||||
|
||||
try:
|
||||
from setuptools_scm import get_version
|
||||
except ModuleNotFoundError:
|
||||
sys.stderr.write("Unable to import setuptools-scm, attempting to install now...\n")
|
||||
|
||||
os.environ['PIP_DISABLE_PIP_VERSION_CHECK'] = '1'
|
||||
subprocess.check_output([sys.executable, '-m', 'ensurepip'])
|
||||
subprocess.check_output([sys.executable, '-m', 'pip', 'install', 'setuptools-scm'])
|
||||
|
||||
from setuptools_scm import get_version
|
||||
|
||||
version = get_version(root='../..', relative_to=__file__)
|
||||
print(version)
|
||||
|
||||
Reference in New Issue
Block a user