-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADD] runbot_buildout #154
Conversation
if os.path.exists(self._path(odoo_part, 'odoo')): | ||
return self._path(odoo_part, 'odoo', *l, **kw) | ||
return self._path(odoo_part, 'openerp', *l, **kw) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else-return
is not needed if you if
section uses a return
You can use just return ...
without else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about use return early?
if not self.repo_id.uses_buildout:
return ...
# My code for uses_buildout without nested `if` and without `else` reduce cyclomatic complex
lock_path, log_path, | ||
) | ||
else: | ||
return super(RunbotBuild, self)._job_00_init( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I have build.repo_id.uses_buildout=True
but don't have build.branch_id.buildout_version
should continue the normal runbot process?
@api.multi | ||
def _spawn_buildout(self, cmd, lock_path, log_path): | ||
self.ensure_one() | ||
out = open(log_path, "w") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this file closed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by now a few lines below, thanks for this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, What about use with open(log_path, "w")
in order to ensure that this file is closed if there is an error in the middle.
}) | ||
self._github_status() | ||
return False | ||
buildout_file = tempfile.NamedTemporaryFile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about use with
?
with tempfile... as buildout_file:
buildout_file.write(adapted_buildout)
'branch_id': branch.id, | ||
'name': '42', | ||
}) | ||
self.assertIn('parts/', build._server()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is possible add a real tests running all jobs using a repo of example real?
Oh sorry I didn't the WIP label |
thanks for your input anyways, some of your points I didn't think about |
ac4c3c7
to
4e71038
Compare
@moylop260 this is reviewable by now. Seems like there was an incompatible change in runbot: https://travis-ci.org/OCA/runbot-addons/jobs/386271662#L2709 |
cbeb45c
to
2ad3b1f
Compare
) as buildout_file: | ||
buildout_file.write(bytes( | ||
'[buildout]\n' | ||
'extensions = buildout.wheel\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we then also have to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, and I'm going to ruhtlessly steal your snippet to use newer setuptools
80019a9
to
2782c1d
Compare
170d414
to
d4a67e1
Compare
1f1abe1
to
b54447b
Compare
.travis.yml
Outdated
@@ -1,7 +1,7 @@ | |||
language: python | |||
|
|||
python: | |||
- "3.5" | |||
- "3.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why python 3.6?
I mean, odoo uses by default 3.5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have no idea. Must have been a leftover from me working frantically to get the tests running, there were very weird errors
.travis.yml
Outdated
# only install extra dependencies when we're not linting | ||
- pip install zc.recipe.egg --no-cache-dir | ||
# the latest package on pip doesn't speak python3 | ||
- pip install https://github.com/anybox/anybox.recipe.odoo/tarball/master/anybox.recipe.odoo-1.9.3.dev0.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is not good use requirements.txt for this case, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to pin this to a git+https url, but that didn't work the first couple of tries and then I figured I'll just wait it out until this version is released
@api.multi | ||
def _spawn_buildout(self, cmd, lock_path, log_path): | ||
self.ensure_one() | ||
out = open(log_path, "w") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, What about use with open(log_path, "w")
in order to ensure that this file is closed if there is an error in the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Do you have planned squash the commits or you prefer that I use merge&squash github button? |
2b27fa9
to
90be709
Compare
I squashed them, thanks! |
0570e17
to
1982c66
Compare
1be96be
to
e66bab6
Compare
@daramousk @thomaspaulb done |
.travis.yml
Outdated
|
||
before_install: | ||
# Fix https://github.com/travis-ci/travis-ci/issues/8982#issuecomment-354357640 | ||
- python3.5 -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)" | ||
|
||
install: | ||
- pip install zc.recipe.egg --no-cache-dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try using requirements.txt file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll try now
gitlab uses json but runbot uses http since that github supports both (json and http)
No description provided.