Skip to content

Commit 2706ca9

Browse files
committed
Formatted text using flake8
1 parent a7b4bd2 commit 2706ca9

File tree

14 files changed

+116
-94
lines changed

14 files changed

+116
-94
lines changed

docs/build_rules.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ def build(working_directory, configuration):
8585
run_command(
8686
("dot", "-Tpng", item, "-otemp{0}images{0}{1}.png".format(
8787
os.sep, item[:-4])),
88-
working_dir=working_directory)
89-
88+
working_dir=working_directory)
9089

9190
# Get the input and output file names
9291
source = os.path.join(os.path.dirname(working_directory), "README.rst")

makeprojects/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
########################################
7979

8080
# Current version of the library as a numeric tuple
81-
__numversion__ = (1, 1, 0)
81+
__numversion__ = (1, 1, 1)
8282

8383
# Current version of the library
8484
__version__ = ".".join([str(num) for num in __numversion__])

makeprojects/build_rules.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@
9797
# without any parameters, default create recommended
9898
# project for the host machine
9999
MAKEPROJECTS = (
100-
# This example builds Visual Studio 2019 and 2022 for Windows
101-
# {"platform": "windows",
102-
# "type": "library",
103-
# "name": "project",
104-
# "configuration": "Release",
105-
# "ide": ("vs2019", "vs2022")},
100+
# This example builds Visual Studio 2019 and 2022 for Windows
101+
# {"platform": "windows",
102+
# "type": "library",
103+
# "name": "project",
104+
# "configuration": "Release",
105+
# "ide": ("vs2019", "vs2022")},
106106
)
107107

108108
########################################

makeprojects/codewarrior.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
# pylint: disable=consider-using-f-string
4545
# pylint: disable=too-few-public-methods
4646
# pylint: disable=useless-object-inheritance
47+
# pylint: disable=possibly-used-before-assignment
4748

4849
from __future__ import absolute_import, print_function, unicode_literals
4950

@@ -338,7 +339,7 @@ def build(self):
338339
self.file_name))[0],
339340
self.configuration))
340341
cmd = ['cmdide', '-proj', '-bcwef', error_file,
341-
'-y', cw_path, '-z', self.configuration, self.file_name]
342+
'-y', cw_path, '-z', self.configuration, self.file_name]
342343

343344
if self.verbose:
344345
print(' '.join(cmd))
@@ -397,7 +398,7 @@ def match(filename):
397398

398399

399400
def create_build_object(file_name, priority=50,
400-
configurations=None, verbose=False):
401+
configurations=None, verbose=False):
401402
"""
402403
Create BuildMakeFile build records for every desired configuration
403404
@@ -434,13 +435,13 @@ def create_build_object(file_name, priority=50,
434435
if '68K Linker' in linkers:
435436
print(
436437
('"{}" requires a 68k linker '
437-
'which Windows doesn\'t support.').format(file_name))
438+
'which Windows doesn\'t support.').format(file_name))
438439
return []
439440

440441
if 'PPC Linker' in linkers:
441442
print(
442443
('"{}" requires a PowerPC linker '
443-
'which Windows doesn\'t support.').format(file_name))
444+
'which Windows doesn\'t support.').format(file_name))
444445
return []
445446

446447
# If everything is requested, then only build 'Everything'
@@ -473,7 +474,7 @@ def create_build_object(file_name, priority=50,
473474

474475

475476
def create_clean_object(file_name, priority=50,
476-
configurations=None, verbose=False):
477+
configurations=None, verbose=False):
477478
"""
478479
Create BuildMakeFile build records for every desired configuration
479480
@@ -510,13 +511,13 @@ def create_clean_object(file_name, priority=50,
510511
if '68K Linker' in linkers:
511512
print(
512513
("\"{}\" requires a 68k linker "
513-
"which Windows doesn't support.").format(file_name))
514+
"which Windows doesn't support.").format(file_name))
514515
return []
515516

516517
if "PPC Linker" in linkers:
517518
print(
518519
('"{}" requires a PowerPC linker '
519-
'which Windows doesn\'t support.').format(file_name))
520+
'which Windows doesn\'t support.').format(file_name))
520521
return []
521522

522523
# If everything is requested, then only build 'Everything'
@@ -1132,7 +1133,7 @@ def generate(self, line_list, level=4):
11321133
line_list.append(tabs + "<FILE>")
11331134
line_list.append(tabs2 + "<PATHTYPE>Name</PATHTYPE>")
11341135
line_list.append(tabs2 + "<PATH>" + self.filename + "</PATH>")
1135-
line_list.append(tabs2 + "<PATHFORMAT>" + \
1136+
line_list.append(tabs2 + "<PATHFORMAT>" +
11361137
self.format + "</PATHFORMAT>")
11371138
line_list.append(tabs2 + "<FILEKIND>" + self.kind + "</FILEKIND>")
11381139
line_list.append(tabs2 + "<FILEFLAGS>" + self.flags + "</FILEFLAGS>")
@@ -1175,7 +1176,7 @@ def generate(self, line_list, level=4):
11751176
"</TARGETNAME>")
11761177
line_list.append(tabs2 + "<PATHTYPE>Name</PATHTYPE>")
11771178
line_list.append(tabs2 + "<PATH>" + self.filename + "</PATH>")
1178-
line_list.append(tabs2 + "<PATHFORMAT>" + \
1179+
line_list.append(tabs2 + "<PATHFORMAT>" +
11791180
self.format + "</PATHFORMAT>")
11801181
line_list.append(tabs + "</FILEREF>")
11811182

@@ -1572,7 +1573,8 @@ def __init__(self, solution, projectname=None,
15721573
break
15731574
else:
15741575
# Insert the library
1575-
item = "MFCcw_D.lib" if configuration.debug else "MFCcw.lib"
1576+
item = "MFCcw_D.lib" \
1577+
if configuration.debug else "MFCcw.lib"
15761578
liblist.insert(0, item)
15771579

15781580
# Generate the file and group lists

makeprojects/core.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class Attributes(object):
4949
cw_environment_variables: List of CodeWarrior environment variables
5050
custom_rules: Custom build rules
5151
platform: @ref makeprojects.enums.PlatformTypes enum for target platform
52-
project_type: @ref makeprojects.enums.ProjectTypes enum for target output
52+
project_type: @ref makeprojects.enums.ProjectTypes
53+
enum for target output
5354
debug: Boolean for debug information generation
5455
link_time_code_generation: Boolean for LTCG
5556
optimization: Boolean for optimization enable
@@ -66,15 +67,17 @@ class Attributes(object):
6667
_platform: platform value
6768
_project_type: True @ref makeprojects.core.Attributes.project_type
6869
_debug: True @ref makeprojects.core.Attributes.debug
69-
_link_time_code_generation: True @ref makeprojects.core.Attributes.link_time_code_generation
70+
_link_time_code_generation: True
71+
@ref makeprojects.core.Attributes.link_time_code_generation
7072
_optimization: True @ref makeprojects.core.Attributes.optimization
7173
_exceptions: False @ref makeprojects.core.Attributes.exceptions
7274
_analyze: True @ref makeprojects.core.Attributes.analyze
7375
_use_mfc: @ref makeprojects.core.Attributes.use_mfc
7476
_use_atl: @ref makeprojects.core.Attributes.use_atl
7577
_clr_support: @ref makeprojects.core.Attributes.clr_support
7678
_name: True @ref makeprojects.core.Attributes.name
77-
_working_directory: True @ref makeprojects.core.Attributes.working_directory
79+
_working_directory: True
80+
@ref makeprojects.core.Attributes.working_directory
7881
_deploy_folder: True @ref makeprojects.core.Attributes.deploy_folder
7982
_fastcall: None @ref makeprojects.core.Attributes.fastcall
8083
"""
@@ -499,8 +502,9 @@ class SourceFile(object):
499502
for processing.
500503
501504
@note
502-
For hash consistency, @ref makeprojects.core.SourceFile.relative_pathname has all directory
503-
slashes in Windows format "\" instead of Linux/BSD format on all platforms.
505+
For hash consistency, @ref makeprojects.core.SourceFile.relative_pathname
506+
has all directory slashes in Windows format "\" instead of Linux/BSD
507+
format on all platforms.
504508
505509
Attributes:
506510
relative_pathname: File base name with extension
@@ -598,7 +602,7 @@ def __repr__(self):
598602
"""
599603

600604
return "FileType: {} Pathname: \"{}\"".format(str(self.type),
601-
self.get_abspath())
605+
self.get_abspath())
602606

603607
def __str__(self):
604608
"""
@@ -1276,7 +1280,8 @@ class Solution(Attributes):
12761280
ide_code: IDE code for generation
12771281
platform_code: Platform code for generation
12781282
project_list: List of dependent projects
1279-
project_type: @ref makeprojects.enums.ProjectTypes enum for target output
1283+
project_type: @ref makeprojects.enums.ProjectTypes enum
1284+
for target output
12801285
post_process: Python function to handle post processing
12811286
_ide: Private instance of @ref makeprojects.enums.IDETypes
12821287
"""
@@ -1551,8 +1556,8 @@ def generate(self, ide=None):
15511556
# No configurations passed? Abort
15521557
if not configuration_list:
15531558
print(
1554-
"Generator for IDE \"{}\" is incompatible with platform \"{}\"".format(
1555-
ide, last_failed))
1559+
("Generator for IDE \"{}\" is incompatible with platform "
1560+
"\"{}\"").format(ide, last_failed))
15561561
return 10
15571562

15581563
# Get the platform code

makeprojects/masm_support.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ def make_masm_command(command_dict, source_file):
8686
cmd = convert_file_name(" ".join(cmd), source_file)
8787
description = convert_file_name(
8888
"Assembling %(FileName)%(Extension)...", source_file)
89-
outputs = [convert_file_name(x, source_file) for x in outputs]
89+
outputs = [convert_file_name(x, source_file) for x in outputs]
9090

9191
return cmd, description, outputs

makeprojects/watcom.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def build(self):
110110
if watcom_path is None:
111111
file_name = self.file_name
112112
return BuildError(0, file_name,
113-
msg="{} requires Watcom to be installed to build!".format(
114-
file_name))
113+
msg=("{} requires Watcom to be installed "
114+
"to build!").format(file_name))
115115

116116
# Watcom requires the path set up so it can access link files
117117
exe_name = where_is_watcom("wmake", verbose=self.verbose)
@@ -188,7 +188,7 @@ def match(filename):
188188

189189

190190
def create_build_object(file_name, priority=50,
191-
configurations=None, verbose=False):
191+
configurations=None, verbose=False):
192192
"""
193193
Create BuildWatcomFile build records for every desired configuration
194194
@@ -219,7 +219,7 @@ def create_build_object(file_name, priority=50,
219219

220220

221221
def create_clean_object(file_name, priority=50,
222-
configurations=None, verbose=False):
222+
configurations=None, verbose=False):
223223
"""
224224
Create BuildWatcomFile clean records for every desired configuration
225225
@@ -393,8 +393,8 @@ def __init__(self, solution):
393393

394394
# Get the rule list
395395
rule_list = (configuration.custom_rules,
396-
configuration.parent.custom_rules,
397-
configuration.parent.parent.custom_rules)
396+
configuration.parent.custom_rules,
397+
configuration.parent.parent.custom_rules)
398398
get_custom_list(custom_list, rule_list, codefiles)
399399

400400
self.custom_list = custom_list
@@ -720,8 +720,8 @@ def _write_phony_binaries(self, line_list):
720720
"",
721721
target_name + ": .SYMBOLIC",
722722
"\t@if not exist bin @mkdir bin",
723-
"\t@if not exist \"temp\\{0}\" @mkdir \"temp\\{0}\"".format(
724-
bin_folder),
723+
"\t@if not exist \"temp\\{0}\" @mkdir \"temp\\{0}\"".format(
724+
bin_folder),
725725
"\t@set CONFIG=" + configuration.name,
726726
"\t@set TARGET=" + platform_short_code,
727727
"\t@%make bin\\" + bin_name
@@ -1454,7 +1454,7 @@ def write_builds(self, line_list, has_rez):
14541454
line_list.extend([
14551455
"\t@SET WOW={$+$(OBJS)$-}",
14561456
"\t@echo Performing link...",
1457-
"\t@$(LINK) $(LFlags" + configuration.name + \
1457+
"\t@$(LINK) $(LFlags" + configuration.name +
14581458
configuration.platform.get_short_code() + ") "
14591459
"NAME $^@ FILE @wow"
14601460
])

unittests/test_cleanme.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
1313
"""
1414

15-
# pylint: disable=wrong-import-position
16-
1715
import sys
1816
import unittest
1917
import os
@@ -24,6 +22,8 @@
2422
# Insert the location of makeprojects at the begining so it's the first
2523
# to be processed
2624
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
25+
26+
# pylint: disable=wrong-import-position
2727
import makeprojects
2828
from makeprojects.config import BUILD_RULES_PY
2929

@@ -70,10 +70,8 @@ def setUp(self):
7070
# Make sure anything left behind is removed
7171
self.addCleanup(shutil.rmtree, self.tmpdir)
7272

73-
7473
########################################
7574

76-
7775
def tearDown(self):
7876
"""
7977
Restore directory
@@ -82,10 +80,8 @@ def tearDown(self):
8280
# Restore the working directory, if the test did not.
8381
os.chdir(self.saved_cwd)
8482

85-
8683
########################################
8784

88-
8985
@staticmethod
9086
def mkdir(path, *paths):
9187
"""
@@ -155,7 +151,7 @@ def test_cleanme(self):
155151
_IMPORT_BURGER,
156152
_DEF_CLEAN,
157153
("\tburger.clean_directories(working_directory, "
158-
"(\"temp\", \"bin\"))"),
154+
"(\"temp\", \"bin\"))"),
159155
_RETURN_NONE]
160156
)
161157
# Make sure it was written

unittests/test_empty.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
1313
"""
1414

15-
# pylint: disable=wrong-import-position
16-
1715
import os
1816
import sys
1917
import unittest
@@ -24,8 +22,9 @@
2422
# Insert the location of makeprojects at the begining so it's the first
2523
# to be processed
2624
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
27-
from makeprojects.enums import IDETypes
25+
# pylint: disable=wrong-import-position
2826
import makeprojects
27+
from makeprojects.enums import IDETypes
2928

3029
########################################
3130

@@ -42,15 +41,14 @@ def setUp(self):
4241
"""
4342
Handle temporary directory
4443
"""
44+
4545
self.saved_cwd = os.getcwd()
4646
self.tmpdir = os.path.realpath(tempfile.mkdtemp())
4747
# Make sure anything left behind is removed
4848
self.addCleanup(shutil.rmtree, self.tmpdir)
4949

50-
5150
########################################
5251

53-
5452
def tearDown(self):
5553
"""
5654
Restore directory

0 commit comments

Comments
 (0)