Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!eweka.nl!hq-usenetpeers.eweka.nl!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ideally': 0.04; 'explicitly': 0.05; 'run-time': 0.05; 'binary': 0.07; 'distutils': 0.07; 'problem:': 0.07; 'though:': 0.07; 'ugly': 0.07; 'cc:addr:googlegroups.com': 0.09; 'omit': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; 'python': 0.11; "wouldn't": 0.14; 'distutils,': 0.16; 'finney': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'run-time.': 0.16; 'symlink': 0.16; 'files.': 0.16; 'all.': 0.16; 'appropriate': 0.16; 'library': 0.18; "python's": 0.19; 'code,': 0.22; 'hack': 0.22; 'rules': 0.22; 'install': 0.23; 'header:User- Agent:1': 0.23; 'builder': 0.24; 'package.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; "i've": 0.25; 'mention': 0.26; 'header:X-Complaints-To:1': 0.27; 'installed': 0.27; 'record': 0.27; 'correct': 0.29; 'patch': 0.29; "i'm": 0.30; 'writes:': 0.31; 'allows': 0.31; 'this.': 0.32; 'know.': 0.32; 'run': 0.32; 'could': 0.34; 'except': 0.35; 'something': 0.35; 'but': 0.35; 'add': 0.35; 'there': 0.35; 'subject:data': 0.36; 'application': 0.37; 'system,': 0.38; 'ben': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'resource': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'tell': 0.60; 'simply': 0.61; 'visit': 0.64; 'skip:\xe2 10': 0.65; 'temporary': 0.65; 'within': 0.65; 'series': 0.66; '8bit%:43': 0.74; 'russian': 0.74; 'hoping': 0.75; 'discovered': 0.83; 'hate': 0.91; 'soviet': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Ben Finney Subject: Re: Installing resource data files and finding them Date: Mon, 09 Sep 2013 13:51:16 +1000 References: <7wr4d1p3rl.fsf@benfinney.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: rasputin.madmonks.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-Public-Key-ID: 0xBD41714B X-Public-Key-Fingerprint: 9CFE 12B0 791A 4267 887F 520C B7AC 2E51 BD41 714B X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-gpg.asc X-Post-From: Ben Finney Cancel-Lock: sha1:MVEP56EVbqnSPbyJ0BnmZ33DurY= Cc: the-fellowship-of-the-packaging@googlegroups.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1378698694 news.xs4all.nl 15872 [2001:888:2000:d::a6]:42040 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53853 Ben Finney writes: > I will need to change both the build configuration and the application > code, so that instead it allows the resource files to be installed to > an appropriate location on the target system, and seeks the data files > in the correct location when run later. I've used an ugly hack to work around this problem: * Patch the ‘MANIFEST.in’ and ‘setup.py’ to omit all mention of the resource files. This makes the Python Distutils simply omit the resource files and not install them at all. * Add a series of rules to the package builder to explicitly install the resource files to a temporary build location. Make sure these rules work for the multiple binary packages and for multiple builds. * Install the resource files for each package to an FHS-compliant location outside the Python package. * Make a symlink within each installed package to the resource location for the package. That works for now. It's ugly and a maintenance burden, though: I would hate to need to do this for resource files in every Python package. > I had hoped to use Python's standard library (Distutils? Distribute? > Something else?) to access the resources once installed to the correct > location. This needs to allow the choice of location to be made at > install-time, but discovered by the application at run-time. Ideally I wouldn't need to subvert Distutils, but could somehow tell it what I need and have it record the install-time decisions for the run-time application's needs. I'm still hoping there is a standard-library way to do this. Please let me know. -- \ “You are welcome to visit the cemetery where famous Russian and | `\ Soviet composers, artists, and writers are buried daily except | _o__) Thursday.” —Russian orthodox monastery, Moscow | Ben Finney