aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2015-07-09 12:48:32 -0500
committerAndy Doan <andy.doan@linaro.org>2015-07-09 12:54:12 -0500
commit9a94e3bd21c527d22282b921706ac518b432e1df (patch)
tree0fc352104e1b8d76ef071280114c2c68741ee2a7
parent01b549354bd43f03ee5bf05cf44c2d7a6200baaa (diff)
downloadlinaro-license-protection-2015.07.tar.gz
buildinfo: remove need for search-path and full name2015.07
The last commit made full_file_name and search_path unused variables. Removing them simplifies the constructor. Change-Id: I2ac2d92ef1195df5294d07dad84ba98a3f4f4ae5
-rw-r--r--license_protected_downloads/buildinfo.py6
-rw-r--r--license_protected_downloads/common.py5
-rw-r--r--license_protected_downloads/tests/test_buildinfo.py6
3 files changed, 4 insertions, 13 deletions
diff --git a/license_protected_downloads/buildinfo.py b/license_protected_downloads/buildinfo.py
index 42a789b..19c6f46 100644
--- a/license_protected_downloads/buildinfo.py
+++ b/license_protected_downloads/buildinfo.py
@@ -15,9 +15,7 @@ class BuildInfoBase(object):
"openid-launchpad-teams",
]
- def __init__(self, full_name, search_path, content):
- self.full_file_name = full_name
- self.search_path = search_path
+ def __init__(self, full_name, content):
self.fname = os.path.basename(full_name)
self.index = 0
@@ -157,7 +155,7 @@ class BuildInfo(BuildInfoBase):
build_info_file = os.path.join(search_path, "BUILD-INFO.txt")
with open(build_info_file, "r") as f:
- super(BuildInfo, self).__init__(fn, search_path, f.read())
+ super(BuildInfo, self).__init__(fn, f.read())
@classmethod
def get_search_path(cls, path):
diff --git a/license_protected_downloads/common.py b/license_protected_downloads/common.py
index 23aff14..e800ec6 100644
--- a/license_protected_downloads/common.py
+++ b/license_protected_downloads/common.py
@@ -185,10 +185,7 @@ class Artifact(object):
def get_build_info(self):
buf = self.build_info_buffer
if buf:
- sp = fn = self.urlbase[1:]
- if not self.isdir():
- fn = sp + '/' + self.file_name
- return buildinfo.BuildInfoBase(fn, sp, buf)
+ return buildinfo.BuildInfoBase(self.file_name, buf)
def get_listing(self):
if self.isdir():
diff --git a/license_protected_downloads/tests/test_buildinfo.py b/license_protected_downloads/tests/test_buildinfo.py
index 9ab5738..6b04118 100644
--- a/license_protected_downloads/tests/test_buildinfo.py
+++ b/license_protected_downloads/tests/test_buildinfo.py
@@ -19,7 +19,7 @@ class BuildInfoBaseTests(unittest.TestCase):
def setUp(self):
p = os.path.join(THIS_DIRECTORY, "BUILD-INFO.txt")
with open(os.path.join(THIS_DIRECTORY, "BUILD-INFO.txt")) as f:
- self.build_info = BuildInfoBase(p, os.path.dirname(p), f.read())
+ self.build_info = BuildInfoBase(p, f.read())
def test_get_emptyField(self):
value = "notempty"
@@ -187,8 +187,6 @@ class BuildInfoBaseTests(unittest.TestCase):
[{'license-type': 'protected'}, {'license-type': 'protected'}])
def test_getInfoForFile(self):
- self.build_info.full_file_name = os.path.join(
- self.build_info.search_path, 'foo.pyc')
self.build_info.fname = 'foo.pyc'
self.build_info.build_info_array = [{}]
data = ["Format-Version: 2.0",
@@ -205,8 +203,6 @@ class BuildInfoBaseTests(unittest.TestCase):
self.assertEquals(self.build_info.file_info_array, [{}])
def test_getInfoForFile_no_block_for_file(self):
- self.build_info.full_file_name = os.path.join(
- self.build_info.search_path, 'foo.pyc')
self.build_info.fname = 'foo.pyc'
self.build_info.build_info_array = [{}]
data = ["Format-Version: 2.0",