changeset 4ecc798e0876 in trytond:5.6
details: https://hg.tryton.org/trytond?cmd=changeset;node=4ecc798e0876
description:
        Add support for local_version on trydevpi.tryton.org

        issue9928
diffstat:

 .drone.yml |   2 +-
 setup.py   |  19 ++++++++++++++++---
 tox.ini    |   2 +-
 3 files changed, 18 insertions(+), 5 deletions(-)

diffs (60 lines):

diff -r 20537241d79b -r 4ecc798e0876 .drone.yml
--- a/.drone.yml        Wed Dec 02 19:17:27 2020 +0100
+++ b/.drone.yml        Fri Dec 11 15:44:43 2020 +0100
@@ -12,7 +12,7 @@
         environment:
             - CFLAGS=-O0
             - DB_CACHE=/cache
-            - TOX_TESTENV_PASSENV=CFLAGS DB_CACHE
+            - TOX_TESTENV_PASSENV=CFLAGS DB_CACHE CI_BUILD_NUMBER 
CI_JOB_NUMBER CI_JOB_ID
             - POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
         commands:
             - echo "[extensions]" >> /root/.hgrc
diff -r 20537241d79b -r 4ecc798e0876 setup.py
--- a/setup.py  Wed Dec 02 19:17:27 2020 +0100
+++ b/setup.py  Fri Dec 11 15:44:43 2020 +0100
@@ -54,12 +54,24 @@
     download_url = 'hg+http://hg.tryton.org/%s#egg=%s-%s' % (
         name, name, version)
 local_version = []
-for build in ['CI_BUILD_NUMBER', 'CI_JOB_NUMBER', 'CI_JOB_ID']:
-    if os.environ.get(build):
-        local_version.append(os.environ[build])
+if os.environ.get('CI_JOB_ID'):
+    local_version.append(os.environ['CI_JOB_ID'])
+else:
+    for build in ['CI_BUILD_NUMBER', 'CI_JOB_NUMBER']:
+        if os.environ.get(build):
+            local_version.append(os.environ[build])
+        else:
+            local_version = []
+            break
 if local_version:
     version += '+' + '.'.join(local_version)
 
+dependency_links = []
+if minor_version % 2:
+    dependency_links.append(
+        'https://trydevpi.tryton.org/?local_version='
+        + '.'.join(local_version))
+
 if platform.python_implementation() == 'PyPy':
     pg_require = ['psycopg2cffi >= 2.5.4']
 else:
@@ -160,6 +172,7 @@
         'weasyprint': ['weasyprint'],
         'coroutine': ['gevent>=1.1'],
         },
+    dependency_links=dependency_links,
     zip_safe=False,
     test_suite='trytond.tests',
     test_loader='trytond.test_loader:Loader',
diff -r 20537241d79b -r 4ecc798e0876 tox.ini
--- a/tox.ini   Wed Dec 02 19:17:27 2020 +0100
+++ b/tox.ini   Fri Dec 11 15:44:43 2020 +0100
@@ -12,4 +12,4 @@
     postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
     sqlite: DB_NAME={env:SQLITE_NAME::memory:}
     postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
-install_command = pip install --pre {opts} {packages}
+install_command = pip install --pre --find-links 
https://trydevpi.tryton.org/?local_version={env:CI_JOB_ID:{env:CI_BUILD_NUMBER}.{env:CI_JOB_NUMBER}}
 {opts} {packages}

Reply via email to