[Python-checkins] distutils2: Use public method from sysconfig instead of private one to expand paths.
tarek.ziade
python-checkins at python.org
Wed Feb 16 22:23:57 CET 2011
tarek.ziade pushed 7b7827c8e4dd to distutils2:
http://hg.python.org/distutils2/rev/7b7827c8e4dd
changeset: 1045:7b7827c8e4dd
parent: 1043:9ab3a8ca0c6d
user: FELD Boris <lothiraldan at gmail.com>
date: Sat Jan 29 15:39:34 2011 +0100
summary:
Use public method from sysconfig instead of private one to expand paths. Correct a type in config module.
files:
distutils2/_backport/pkgutil.py
distutils2/command/install_data.py
docs/source/setupcfg.rst
diff --git a/distutils2/_backport/pkgutil.py b/distutils2/_backport/pkgutil.py
--- a/distutils2/_backport/pkgutil.py
+++ b/distutils2/_backport/pkgutil.py
@@ -1169,4 +1169,4 @@
yield dist
def open(distribution_name, relative_path):
-
+ pass
diff --git a/distutils2/command/install_data.py b/distutils2/command/install_data.py
--- a/distutils2/command/install_data.py
+++ b/distutils2/command/install_data.py
@@ -9,7 +9,7 @@
import os
from distutils2.command.cmd import Command
from distutils2.util import change_root, convert_path
-from distutils2._backport.sysconfig import _expand_vars, _subst_vars, get_paths
+from distutils2._backport.sysconfig import get_paths
class install_data(Command):
@@ -55,8 +55,8 @@
def expand_categories(self, path_with_categories):
local_vars = get_paths()
local_vars['distribution.name'] = self.distribution.metadata['Name']
- expanded_path = _subst_vars(path_with_categories, local_vars)
- expanded_path = _subst_vars(expanded_path, local_vars)
+ expanded_path = get_paths(path_with_categories, local_vars)
+ expanded_path = get_paths(expanded_path, local_vars)
if '{' in expanded_path and '}' in expanded_path:
self.warn("Unable to expand %s, some categories may missing." %
path_with_categories)
@@ -66,7 +66,7 @@
sources = []
for file in self.data_files:
destination = convert_path(self.expand_categories(file[1]))
- if os.path.file(destination):
+ if os.path.isfile(destination):
sources.append(destination)
return sources
diff --git a/docs/source/setupcfg.rst b/docs/source/setupcfg.rst
--- a/docs/source/setupcfg.rst
+++ b/docs/source/setupcfg.rst
@@ -149,15 +149,38 @@
data-files
==========
+###
+source -> destination
+
+fichier-final = destination + source
+
+There is an {alias} for each categories of datafiles
+-----
+source may be a glob (*, ?, **, {})
+
+order
+
+exclude
+--
+base-prefix
+
+####
+overwrite system config for {alias}
+
+####
+extra-categori
+
This section describes the files used by the project which must not be installed in the same place that python modules or libraries.
The format for specifing data files is :
- **glob_syntax** = **destination**
+ **source** = **destination**
Example::
- scripts/ *.bin = {scripts}
+ scripts/script1.bin = {scripts}
+
+It means that the file scripts/script1.bin will be placed
It means that every file which match the glob_syntax will be placed in the destination. A part of the path of the file will be stripped when it will be expanded and another part will be append to the destination. For more informations about which part of the path will be stripped or not, take a look at next sub-section globsyntax_.
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list