Skip to content

Commit fbba314

Browse files
committed
Refactored the project layout, following the Python apps standards, improved the setup.py content for proper build and future pypi release publication
1 parent b370da5 commit fbba314

File tree

138 files changed

+72
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+72
-26
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ python:
33
- "2.6"
44
- "2.7"
55
install: "pip install -r requirements.txt --use-mirrors"
6-
script: python tests.py
6+
script: python setup.py test

about.ABOUT

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
about_resource: .
1+
about_resource: about-code-tool/about.py
22

33
name: ABOUT tool
44
version: 0.8.1
@@ -14,9 +14,9 @@ changelog_file: CHANGELOG.txt
1414
vcs_tool: git
1515
vcs_repository: https://github.com/dejacode/about-code-tool.git
1616

17-
description: This is a tool to process ABOUT files. An ABOUT file provides a
18-
simple way to document the provenance (origin and license) 'about' a software
19-
component. An ABOUT file is a small text file stored in the codebase
17+
description: This is a tool to process ABOUT files. An ABOUT file provides a
18+
simple way to document the provenance (origin and license) 'about' a software
19+
component. An ABOUT file is a small text file stored in the codebase
2020
side-by-side with the software component that it documents.
2121

2222

@@ -35,4 +35,3 @@ notice:
3535
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3636
See the License for the specific language governing permissions and
3737
limitations under the License.
38-

about_code_tool/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# =============================================================================
2+
# Copyright (c) 2013 by nexB, Inc. http://www.nexb.com/ - All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
# =============================================================================
File renamed without changes.

genabout.py renamed to about_code_tool/genabout.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@
4242
Warn = namedtuple('Warn', 'field_name field_value message',)
4343
Error = namedtuple('Error', 'field_name field_value message',)
4444

45+
self_path = abspath(dirname(__file__))
46+
47+
4548
class GenAbout(object):
46-
4749
def __init__(self):
4850
self.warnings = []
4951
self.errors = []
@@ -93,7 +95,6 @@ def read_input(self, input_file, mapping):
9395
components_list.append(file_list)
9496
return components_list
9597

96-
9798
@staticmethod
9899
def config_mapping(mapping):
99100
about_resource = 'about_resource'
@@ -102,7 +103,7 @@ def config_mapping(mapping):
102103
version = 'version'
103104
if mapping:
104105
try:
105-
with open('MAPPING.CONFIG', "rU") as file_in:
106+
with open(join(self_path, 'MAPPING.CONFIG'), "rU") as file_in:
106107
for line in file_in.readlines():
107108
if not line.startswith('#'):
108109
if line.partition(':')[0] == 'about_resource':
@@ -129,7 +130,6 @@ def config_mapping(mapping):
129130
else:
130131
return about_resource, about_file, name, version
131132

132-
133133
def verify_license_files(self, input_list, project_path):
134134
"""
135135
Verify the existence of the 'license text file'
@@ -162,7 +162,6 @@ def verify_license_files(self, input_list, project_path):
162162
sys.exit(errno.EINVAL)
163163
return output_list
164164

165-
166165
def copy_license_files(self, gen_location, license_list):
167166
"""
168167
copy the 'license_text_file' into the gen_location
@@ -177,15 +176,14 @@ def copy_license_files(self, gen_location, license_list):
177176
makedirs(license_parent_dir)
178177
shutil.copy2(license_path, output_license_path)
179178

180-
"""
179+
"""
181180
def extract_licesen_from_url(self):
182181
# This function needs discussion
183182
test = urllib2.urlopen("https://enterprise.dejacode.com/license_library/Demo/gpl-1.0/#license-text")
184183
with open('testdata/test_file.txt', 'wb') as output_file:
185184
output_file.write(test.read())
186185
"""
187186

188-
189187
def pre_generation(self, gen_location, input_list, action_num, all_in_one):
190188
"""
191189
check the existence of the output location and handle differently
@@ -234,7 +232,6 @@ def pre_generation(self, gen_location, input_list, action_num, all_in_one):
234232
output_list.append(component_list)
235233
return output_list
236234

237-
238235
def format_output(self, input_list):
239236
"""
240237
process the input and covert to the specific strings format
@@ -270,7 +267,6 @@ def format_output(self, input_list):
270267
components_list.append(component)
271268
return components_list
272269

273-
274270
def write_output(self, output):
275271
for line in output:
276272
about_file_location = line[0]
@@ -280,7 +276,6 @@ def write_output(self, output):
280276
with open(about_file_location, 'wb') as output_file:
281277
output_file.write(context)
282278

283-
284279
def warnings_errors_summary(self, gen_location, show_error_num):
285280
display_error = False
286281
display_warning = False

about_code_tool/tests/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# =============================================================================
2+
# Copyright (c) 2013 by nexB, Inc. http://www.nexb.com/ - All rights reserved.
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
# =============================================================================

tests.py renamed to about_code_tool/tests/test_about.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import tempfile
2424
import unittest
2525

26-
import about
26+
from about_code_tool import about
2727

2828

2929
class BasicTest(unittest.TestCase):

0 commit comments

Comments
 (0)