Skip to content
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

Do not fail on twine check if an addon has no setup.py #96

Merged
merged 3 commits into from
Dec 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
20191226
~~~~~~~~

**Bug fixes**

- do not fail on ``twine check`` when an addon has no ``setup.py``
`#96 <https://github.com/OCA/oca-github-bot/pull/96>`_

20191126
~~~~~~~~

Expand Down
18 changes: 9 additions & 9 deletions src/oca_github_bot/build_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
_logger = logging.getLogger(__name__)


def _build_wheel(addon_dir, dist_dir):
def _build_and_check_wheel(addon_dir, dist_dir):
manifest = get_manifest(addon_dir)
if not manifest.get("installable", True):
return
return False
series = get_odoo_series_from_version(manifest.get("version", ""))
if series < (8, 0):
return
return False
addon_name = os.path.basename(addon_dir)
setup_dir = os.path.join(addon_dir, "..", "setup", addon_name)
setup_file = os.path.join(setup_dir, "setup.py")
if not os.path.isfile(setup_file):
return
return False
with tempfile.TemporaryDirectory() as tempdir:
bdist_dir = os.path.join(tempdir, "build")
os.mkdir(bdist_dir)
Expand All @@ -39,6 +39,8 @@ def _build_wheel(addon_dir, dist_dir):
"py2" if series < (11, 0) else "py3",
]
check_call(cmd, cwd=setup_dir)
_check_wheels(dist_dir)
return True


def _check_wheels(dist_dir):
Expand All @@ -48,15 +50,13 @@ def _check_wheels(dist_dir):

def build_and_check_wheel(addon_dir):
with tempfile.TemporaryDirectory() as dist_dir:
_build_wheel(addon_dir, dist_dir)
_check_wheels(dist_dir)
_build_and_check_wheel(addon_dir, dist_dir)


def build_and_publish_wheel(addon_dir, simple_index_root, dry_run=False):
with tempfile.TemporaryDirectory() as dist_dir:
_build_wheel(addon_dir, dist_dir)
_check_wheels(dist_dir)
_publish_dist_dir_to_simple_index(dist_dir, simple_index_root, dry_run)
if _build_and_check_wheel(addon_dir, dist_dir):
_publish_dist_dir_to_simple_index(dist_dir, simple_index_root, dry_run)


def build_and_publish_wheels(addons_dir, simple_index_root, dry_run=False):
Expand Down