From patchwork Sat Oct 6 16:02:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hauke Mehrtens X-Patchwork-Id: 10629245 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E66C1731 for ; Sat, 6 Oct 2018 16:03:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45D1E291BD for ; Sat, 6 Oct 2018 16:03:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35FFD291C9; Sat, 6 Oct 2018 16:03:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 313AB291BD for ; Sat, 6 Oct 2018 16:03:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726085AbeJFXHI (ORCPT ); Sat, 6 Oct 2018 19:07:08 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:28636 "EHLO mx2.mailbox.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725266AbeJFXHI (ORCPT ); Sat, 6 Oct 2018 19:07:08 -0400 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 6BFFD406F8; Sat, 6 Oct 2018 18:03:14 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id Bhk4KKAZbuQ3; Sat, 6 Oct 2018 18:03:13 +0200 (CEST) From: Hauke Mehrtens To: seth.forshee@canonical.com Cc: haim.dreyfuss@intel.com, linux-wireless@vger.kernel.org, Hauke Mehrtens Subject: [PATCH] wireless-regdb: remove dependency to python attr Date: Sat, 6 Oct 2018 18:02:54 +0200 Message-Id: <20181006160254.7980-1-hauke@hauke-m.de> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 8607edfdb6568 ("wireless-regdb: Parse wmm rule data") introduced a dependency to the python module attr which is not included by default in all python installations. Replace the code with manually coding the constructor instead of using attr. This makes the code also work on systems without attr. I would like to avoid an additional dependency in OpenWrt where we compile the regulatory database inside of the build system. Signed-off-by: Hauke Mehrtens --- dbparse.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dbparse.py b/dbparse.py index 5fe752b..993f757 100755 --- a/dbparse.py +++ b/dbparse.py @@ -5,7 +5,6 @@ from functools import total_ordering import sys, math from math import ceil, log from collections import defaultdict, OrderedDict -import attr # must match enum nl80211_reg_rule_flags @@ -32,16 +31,17 @@ dfs_regions = { @total_ordering -@attr.s(frozen=True, cmp=False) class WmmRule(object): - vo_c = attr.ib() - vi_c = attr.ib() - be_c = attr.ib() - bk_c = attr.ib() - vo_ap = attr.ib() - vi_ap = attr.ib() - be_ap = attr.ib() - bk_ap = attr.ib() + + def __init__(self, vo_c, vi_c, be_c, bk_c, vo_ap, vi_ap, be_ap, bk_ap): + self.vo_c = vo_c + self.vi_c = vi_c + self.be_c = be_c + self.bk_c = bk_c + self.vo_ap = vo_ap + self.vi_ap = vi_ap + self.be_ap = be_ap + self.bk_ap = bk_ap def _as_tuple(self): return (self.vo_c, self.vi_c, self.be_c, self.bk_c,