Dirk Mueller
3d0baf1650
0001-Don-t-ignore-data-files.patch OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pbr?expand=0&rev=57
97 lines
3.6 KiB
Diff
97 lines
3.6 KiB
Diff
From a432bc2930ad0c5463163654bc18a18f8e2b417e Mon Sep 17 00:00:00 2001
|
|
From: Sachi King <nakato@nakato.io>
|
|
Date: Thu, 21 Jul 2016 17:15:34 +1000
|
|
Subject: [PATCH] Don't ignore data-files
|
|
|
|
We're currently ignoring data-files, and it looks like the problem
|
|
would sometimes be present starting with 2796f9, 0.5.7, and always be present
|
|
from 04984a, 0.5.15.
|
|
|
|
This normalises all config keys from - to _ as soon as we read the
|
|
config, which means future access and modification does not need to
|
|
concern itself with the possibility of the key being a '-' instead '_'.
|
|
|
|
This should make it more difficult for code accessing/modifying values
|
|
in the config to clobber user set values or be unaware of them, like
|
|
in the case of the files hook.
|
|
|
|
As well, support download-url, but properly expose it as download_url.
|
|
|
|
Co-Authored-By: Julien Danjou <julien@danjou.info>
|
|
Change-Id: I062774c706b8f7339dda46689a226b80ae6ac277
|
|
---
|
|
pbr/tests/test_packaging.py | 11 +++++++++++
|
|
pbr/tests/testpackage/setup.cfg | 2 +-
|
|
pbr/util.py | 6 +++---
|
|
3 files changed, 15 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py
|
|
index f532b76..b84cc9a 100644
|
|
--- a/pbr/tests/test_packaging.py
|
|
+++ b/pbr/tests/test_packaging.py
|
|
@@ -304,6 +304,17 @@ class TestPackagingInGitRepoWithCommit(base.BaseTestCase):
|
|
self.expectThat(stdout, matchers.Contains('Generating ChangeLog'))
|
|
|
|
|
|
+class TestExtrafileInstallation(base.BaseTestCase):
|
|
+ def test_install_glob(self):
|
|
+ stdout, _, _ = self.run_setup(
|
|
+ 'install', '--root', self.temp_dir + 'installed',
|
|
+ allow_fail=False)
|
|
+ self.expectThat(
|
|
+ stdout, matchers.Contains('copying data_files/a.txt'))
|
|
+ self.expectThat(
|
|
+ stdout, matchers.Contains('copying data_files/b.txt'))
|
|
+
|
|
+
|
|
class TestPackagingInGitRepoWithoutCommit(base.BaseTestCase):
|
|
|
|
def setUp(self):
|
|
diff --git a/pbr/tests/testpackage/setup.cfg b/pbr/tests/testpackage/setup.cfg
|
|
index c4ba378..a6d127a 100644
|
|
--- a/pbr/tests/testpackage/setup.cfg
|
|
+++ b/pbr/tests/testpackage/setup.cfg
|
|
@@ -30,7 +30,7 @@ keywords = packaging, distutils, setuptools
|
|
[files]
|
|
packages = pbr_testpackage
|
|
package-data = testpackage = package_data/*.txt
|
|
-data-files = testpackage/data_files = data_files/*.txt
|
|
+data-files = testpackage/data_files = data_files/*
|
|
extra-files = extra-file.txt
|
|
|
|
[entry_points]
|
|
diff --git a/pbr/util.py b/pbr/util.py
|
|
index daad138..30853c6 100644
|
|
--- a/pbr/util.py
|
|
+++ b/pbr/util.py
|
|
@@ -105,7 +105,7 @@ D1_D2_SETUP_ARGS = {
|
|
"description": ("metadata", "summary"),
|
|
"keywords": ("metadata",),
|
|
"long_description": ("metadata", "description"),
|
|
- "download-url": ("metadata",),
|
|
+ "download_url": ("metadata",),
|
|
"classifiers": ("metadata", "classifier"),
|
|
"platforms": ("metadata", "platform"), # **
|
|
"license": ("metadata",),
|
|
@@ -212,6 +212,8 @@ def cfg_to_args(path='setup.cfg', script_args=()):
|
|
config = {}
|
|
for section in parser.sections():
|
|
config[section] = dict(parser.items(section))
|
|
+ for k in config[section]:
|
|
+ config[section][k.replace('-', '_')] = config[section].pop(k)
|
|
|
|
# Run setup_hooks, if configured
|
|
setup_hooks = has_get_option(config, 'global', 'setup_hooks')
|
|
@@ -649,8 +651,6 @@ def run_command_hooks(cmd_obj, hook_kind):
|
|
def has_get_option(config, section, option):
|
|
if section in config and option in config[section]:
|
|
return config[section][option]
|
|
- elif section in config and option.replace('_', '-') in config[section]:
|
|
- return config[section][option.replace('_', '-')]
|
|
else:
|
|
return False
|
|
|
|
--
|
|
2.11.0
|
|
|