Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Odoo scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo scripts
Commits
5b25b6ab
Commit
5b25b6ab
authored
2 years ago
by
Vincent Hatakeyama
Browse files
Options
Downloads
Patches
Plain Diff
On docker_build_copy, when not run localy, do not build.
parent
95175b1d
No related branches found
Branches containing commit
Tags
TAG_7.0.2.0a1
Tags containing commit
1 merge request
!186
✨ On docker_build_copy, when not run localy, do not build.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
NEWS.rst
+5
-0
5 additions, 0 deletions
NEWS.rst
odoo_scripts/docker_build_copy.py
+52
-17
52 additions, 17 deletions
odoo_scripts/docker_build_copy.py
with
58 additions
and
18 deletions
.gitlab-ci.yml
+
1
−
1
View file @
5b25b6ab
...
...
@@ -53,7 +53,7 @@
image
:
$TEMP_IMAGE
script
:
-
python3 -m pip install mypy types-PyYAML types-psycopg2 types-python-dateutil
types-requests
types-requests
build twine
-
mypy odoo_scripts tests
rules
:
-
if
:
$CI_COMMIT_TAG ==
null
...
...
This diff is collapsed.
Click to expand it.
NEWS.rst
+
5
−
0
View file @
5b25b6ab
...
...
@@ -2,6 +2,11 @@
History
=======
20.2.0
------
docker_build_copy: when not in CI, default to copying packages and let the package be build in the image.
20.1.0
------
...
...
This diff is collapsed.
Click to expand it.
odoo_scripts/docker_build_copy.py
+
52
−
17
View file @
5b25b6ab
...
...
@@ -13,5 +13,5 @@
_logger
=
logging
.
getLogger
(
__name__
)
__version__
=
"
2.
1
.0
"
__version__
=
"
2.
2
.0
"
__date__
=
"
2020-06-30
"
...
...
@@ -17,5 +17,5 @@
__date__
=
"
2020-06-30
"
__updated__
=
"
2023-0
2-28
"
__updated__
=
"
2023-0
3-31
"
PYTHON_PACKAGES_DIR
=
"
python_packages
"
...
...
@@ -52,8 +52,13 @@
return
path
.
replace
(
os
.
path
.
sep
,
"
-
"
)
def
copy
():
"""
Copy modules for a build
"""
def
copy
(
build_package_locally
:
Optional
[
bool
]
=
None
):
"""
Copy modules for a build
:param build_package_locally: build package that have package compile set to True
rather than just copy them. (in CI, build package to reduce artifact size, locally
default to copying them)
"""
c
=
Config
()
modules
=
[
os
.
path
.
realpath
(
module
)
for
module
in
c
.
modules
]
target
=
"
odoo_modules
"
...
...
@@ -84,6 +89,7 @@
copy_paths
=
set
()
packages_to_compile
=
[]
requirements
=
[]
ci_mode
=
"
CI
"
in
os
.
environ
and
os
.
environ
[
"
CI
"
].
lower
()
==
"
true
"
# Try to include the CVS information in target so that setuptools-scm and
# setuptools-odoo work as expected
for
package
,
options
in
c
.
python_packages
.
items
():
...
...
@@ -87,7 +93,9 @@
# Try to include the CVS information in target so that setuptools-scm and
# setuptools-odoo work as expected
for
package
,
options
in
c
.
python_packages
.
items
():
if
options
[
"
compile
"
]
in
(
"
True
"
,
"
true
"
):
if
options
[
"
compile
"
]
in
(
"
True
"
,
"
true
"
)
and
(
ci_mode
or
build_package_locally
):
packages_to_compile
.
append
(
package
)
else
:
cvs_parent
=
package
...
...
@@ -129,6 +137,5 @@
]
_logger
.
debug
(
"
"
.
join
(
cmd
))
check_call
(
cmd
)
# The option to ignore the python verion can be an issue with newer syntax.
# In the CI it will work fine, locally, maybe add an option to avoid compiling?
# The option to ignore the python version can be an issue with newer syntax.
if
packages_to_compile
:
...
...
@@ -134,13 +141,31 @@
if
packages_to_compile
:
cmd
=
[
sys
.
executable
,
"
-m
"
,
"
pip
"
,
"
wheel
"
,
"
--no-deps
"
,
"
-w
"
,
target
,
"
--ignore-requires-python
"
,
]
+
packages_to_compile
# try with build if present, fallback to pip wheel otherwise
try
:
# build is not usable directly so use a subprocess.
# Disable flake8, this is just to test that the package is installed.
import
build
# type: ignore[import] # noqa: F401
cmd
=
[
sys
.
executable
,
"
-m
"
,
"
build
"
,
"
--outdir
"
,
target
,
]
+
packages_to_compile
_logger
.
debug
(
"
"
.
join
(
cmd
))
check_call
(
cmd
)
except
ImportError
:
# pip is not usable directly, it is indicated in its doc to use subprocess
# instead.
cmd
=
[
sys
.
executable
,
"
-m
"
,
"
pip
"
,
"
wheel
"
,
"
--no-deps
"
,
"
-w
"
,
target
,
"
--ignore-requires-python
"
,
]
+
packages_to_compile
_logger
.
debug
(
"
"
.
join
(
cmd
))
check_call
(
cmd
)
...
...
@@ -145,5 +170,15 @@
_logger
.
debug
(
"
"
.
join
(
cmd
))
check_call
(
cmd
)
try
:
# Disable flake8, this is just to test that the package is installed
import
twine
# type: ignore[import] # noqa: F401
cmd
=
[
sys
.
executable
,
"
-m
"
,
"
twine
"
,
"
check
"
,
f
"
{
target
}
/*
"
]
check_call
(
cmd
)
except
ImportError
:
_logger
.
warn
(
"
No twine, no check done
"
)
for
entry
in
os
.
listdir
(
target
):
if
entry
.
endswith
(
"
.whl
"
):
requirements
.
append
(
os
.
path
.
join
(
"
.
"
,
target
,
entry
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment