New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 631342 link

Starred by 2 users

Issue metadata

Status: Archived
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

factory: Need better Enum library

Project Member Reported by hungte@chromium.org, Jul 26 2016

Issue description

Currently factory software is using a Enum (in type_utils) that is implemented from scratch, supporting only literals.

Developers are requesting for more "real" or powerful Enums, for example auto-increasing numbers or values that is different from the name of Enum itself ( https://chromium-review.googlesource.com/#/c/363034 ).

Part of the functions are already implemented in Python 3.4 'Enum' (with backport for 2.7 as enum34 - https://pypi.python.org/pypi/enum34 ).

As the result, in comparison to building our complicated Enum, we should introduce enum34 into the factory software, and keep current factory_utils.Enum as a special case (or eliminate it someday).
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jul 27 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/6196935730d703d02ddf10f1a0c2c41fd9a605ac

commit 6196935730d703d02ddf10f1a0c2c41fd9a605ac
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue Jul 26 06:24:09 2016

chromeos-factory-deps: Add enum34 into dependency.

The 'enum34' (Enum from Python 3.4) is going to be used in factory
toolkit and should be included.

BUG= chromium:609045 , chromium:631342 
TEST=emerge-link chromeos-factory-deps

Change-Id: I1d7a6e58b5f3d740eaf3acd0e84e19a0d1f25a6a
Reviewed-on: https://chromium-review.googlesource.com/363221
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/6196935730d703d02ddf10f1a0c2c41fd9a605ac/virtual/target-chromium-os-sdk/target-chromium-os-sdk-1.ebuild
[rename] https://crrev.com/6196935730d703d02ddf10f1a0c2c41fd9a605ac/chromeos-base/chromeos-factory-deps/chromeos-factory-deps-1-r20.ebuild
[modify] https://crrev.com/6196935730d703d02ddf10f1a0c2c41fd9a605ac/chromeos-base/chromeos-factory-deps/chromeos-factory-deps-1.ebuild

Project Member

Comment 2 by bugdroid1@chromium.org, Jul 29 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/ee68555f07e1150d700d555d1892d93f7dcb01b6

commit ee68555f07e1150d700d555d1892d93f7dcb01b6
Author: Hung-Te Lin <hungte@chromium.org>
Date: Tue Jul 26 07:22:15 2016

make_par: Add external package 'enum' (enum34).

The 'enum' is not a standard package in Python 2.7 and must be installed
explicitly so we have to include it in PAR.

BUG= chromium:631342 
TEST=make test
CQ-DEPEND=CL:363221

Change-Id: I93818840407da40a21e19660a9ee5f9fbe4e6a16
Reviewed-on: https://chromium-review.googlesource.com/363242
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Joel Kitching <kitching@chromium.org>

[modify] https://crrev.com/ee68555f07e1150d700d555d1892d93f7dcb01b6/py/tools/make_par.py

Project Member

Comment 3 by bugdroid1@chromium.org, Aug 1 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/factory/+/2d22dcb1cc65391b39083d57eaa9b2e86758453f

commit 2d22dcb1cc65391b39083d57eaa9b2e86758453f
Author: Joel Kitching <kitching@google.com>
Date: Wed Jul 27 23:20:49 2016

external: add symlink for enum34 library

Also add an entry to deps.conf.

Enum34 library can now be used as follows:

  from cros.factory.external import enum
  class MyColours(enum.Enum):
    RED = 'red'
    BLUE = 'blue
    GREEN = 'green

BUG= chromium:609045 , chromium:631342 
TEST=Manually checking import
CQ-DEPEND=CL:363221

Change-Id: Ibd975251b68349b8e6a4cde50a52b7d900609890
Reviewed-on: https://chromium-review.googlesource.com/364030
Commit-Ready: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>

[modify] https://crrev.com/2d22dcb1cc65391b39083d57eaa9b2e86758453f/py/tools/deps.conf
[add] https://crrev.com/2d22dcb1cc65391b39083d57eaa9b2e86758453f/py/external/enum.py

Status: Fixed (was: Untriaged)
Labels: VerifyIn-54

Comment 7 by dchan@chromium.org, Oct 7 2016

Labels: VerifyIn-55

Comment 8 by dchan@chromium.org, Oct 10 2016

Labels: -VerifyIn-55

Comment 9 by dchan@google.com, Nov 19 2016

Labels: VerifyIn-56

Comment 10 by dchan@google.com, Jan 21 2017

Labels: VerifyIn-57

Comment 11 by dchan@google.com, Mar 4 2017

Labels: VerifyIn-58

Comment 12 by dchan@google.com, Apr 17 2017

Labels: VerifyIn-59

Comment 13 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61

Comment 15 by dchan@chromium.org, Oct 14 2017

Status: Archived (was: Fixed)

Sign in to add a comment