Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2291D431FCB for ; Sat, 10 May 2014 10:04:26 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fW8toSVKpUom for ; Sat, 10 May 2014 10:04:18 -0700 (PDT) Received: from qmta03.westchester.pa.mail.comcast.net (qmta03.westchester.pa.mail.comcast.net [76.96.62.32]) by olra.theworths.org (Postfix) with ESMTP id 9035A431FC0 for ; Sat, 10 May 2014 10:04:18 -0700 (PDT) Received: from omta18.westchester.pa.mail.comcast.net ([76.96.62.90]) by qmta03.westchester.pa.mail.comcast.net with comcast id 0Glh1o0041wpRvQ53H4JYo; Sat, 10 May 2014 17:04:18 +0000 Received: from odin.tremily.us ([24.18.63.50]) by omta18.westchester.pa.mail.comcast.net with comcast id 0H4G1o00o152l3L3eH4Hor; Sat, 10 May 2014 17:04:18 +0000 Received: from mjolnir.tremily.us (unknown [192.168.0.140]) by odin.tremily.us (Postfix) with ESMTPS id A20E311969A7; Sat, 10 May 2014 10:04:16 -0700 (PDT) Received: (nullmailer pid 24531 invoked by uid 1000); Sat, 10 May 2014 17:03:44 -0000 From: "W. Trevor King" To: notmuch@notmuchmail.org Subject: [PATCH v2 2/5] doc/prerst2man.py: Convert execfile to import Date: Sat, 10 May 2014 10:03:33 -0700 Message-Id: <4f5a9c7d4fc607128aebbc1443d6da5439f0d2eb.1399740604.git.wking@tremily.us> X-Mailer: git-send-email 1.9.1.353.gc66d89d In-Reply-To: References: In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1399741458; bh=surGy6r4gr9e//xrzFrd6sbiw4m4FMtByh0+q6ZgS2o=; h=Received:Received:Received:Received:From:To:Subject:Date: Message-Id; b=CDqLKR3sxW14Oi+IfJwyl4Kz4eirvIFoi8xX/x4p+UwOFSpV9bWCwKLhLNPcp9WPY BGZe0cmEF1EQUWSizGvrzSJJTUr4MLfpTCp1org7U0h4UHJtiq2TOVaEWaiiJNwwny bK0FHdiHx1MFEeNhT/LZD37+gvB/Kvd9asc3AhcEyozRn8iV3slZaft62F1zY1jGnL GrCnONYDhXi+EJKqq77kAYY8qmjsv1nmsVeAzTKrXz74TrZHxI27mpWjHVhlrBlEt3 yhpw3Ety4kR7G0W53dSlDFQcdTXzyx+UGI4iXVzvwHcBT2n/mz6otcIaA0T8ohYIrs IxDlf1krX4P1Q== Cc: Tomi Ollila X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2014 17:04:26 -0000 excefile is gone in Python 3 [1]. Instead of exec-ing the configuration, it's easier to insert the source directory in Python's path [2], and just import the configuration. With this change, prerst2man.py is compatible with both Python 2 and 3. [1]: https://docs.python.org/3.0/whatsnew/3.0.html#builtins [2]: https://docs.python.org/3/library/sys.html#sys.path --- doc/prerst2man.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/prerst2man.py b/doc/prerst2man.py index 81ce817..7d78e9b 100644 --- a/doc/prerst2man.py +++ b/doc/prerst2man.py @@ -1,18 +1,20 @@ -from sys import argv +import sys from datetime import date from os.path import dirname, isdir from os import makedirs, system import re -rst2man = argv[1] -sourcedir = argv[2] -outdir = argv[3] +rst2man = sys.argv[1] +sourcedir = sys.argv[2] +outdir = sys.argv[3] + +sys.path.insert(0, sourcedir) +import conf + if not isdir(outdir): makedirs(outdir, 0o755) -execfile(sourcedir + "/conf.py") - def header(file, startdocname, command, description, authors, section): file.write(""" @@ -29,10 +31,10 @@ def header(file, startdocname, command, description, authors, section): '-' * len(description), description, '-' * len(description), -date.today().isoformat(), release, section, project)) +date.today().isoformat(), conf.release, section, conf.project)) blankre = re.compile("^\s*$") -for page in man_pages: +for page in conf.man_pages: outdirname = outdir + '/' + dirname(page[0]) if not isdir(outdirname): makedirs(outdirname, 0o755) -- 1.9.1.353.gc66d89d