Merge lp:~dholbach/snapcraft/fix-pep8-and-doc-indentation into lp:~snappy-dev/snapcraft/core
- fix-pep8-and-doc-indentation
- Merge into core
| Status: | Superseded |
|---|---|
| Proposed branch: | lp:~dholbach/snapcraft/fix-pep8-and-doc-indentation |
| Merge into: | lp:~snappy-dev/snapcraft/core |
| Diff against target: |
1628 lines (+399/-193) 33 files modified
docs/snapcraft-advanced-features.md (+2/-2) examples/py2-project/sha3sum.py (+0/-1) examples/py3-project/sha3sum.py (+0/-1) examples/webcam-webui/config.py (+6/-3) integration-tests/data/pypi-config/config.py (+7/-3) runtests.sh (+1/-1) setup.py (+4/-2) snapcraft/__init__.py (+24/-9) snapcraft/cmds.py (+35/-15) snapcraft/common.py (+7/-3) snapcraft/main.py (+34/-16) snapcraft/meta.py (+16/-8) snapcraft/plugin.py (+29/-13) snapcraft/plugins/ant.py (+2/-1) snapcraft/plugins/autotools.py (+2/-2) snapcraft/plugins/cmake.py (+2/-2) snapcraft/plugins/copy.py (+2/-1) snapcraft/plugins/go.py (+2/-1) snapcraft/plugins/maven.py (+2/-1) snapcraft/plugins/python2.py (+4/-2) snapcraft/plugins/python3.py (+2/-1) snapcraft/plugins/qml.py (+10/-5) snapcraft/repo.py (+8/-4) snapcraft/sources.py (+37/-17) snapcraft/tests/test_base_plugin.py (+2/-1) snapcraft/tests/test_cmds.py (+2/-1) snapcraft/tests/test_copy_plugin.py (+2/-1) snapcraft/tests/test_meta.py (+26/-13) snapcraft/tests/test_plugin.py (+4/-2) snapcraft/tests/test_repo.py (+4/-2) snapcraft/tests/test_sources.py (+44/-22) snapcraft/tests/test_yaml.py (+59/-28) snapcraft/yaml.py (+18/-9) |
| To merge this branch: | bzr merge lp:~dholbach/snapcraft/fix-pep8-and-doc-indentation |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Daniel Holbach (community) | Needs Information on 2015-10-05 | ||
| John Lenton | Approve on 2015-10-05 | ||
| Sergio Schvezov | 2015-10-02 | Needs Fixing on 2015-10-02 | |
|
Review via email:
|
|||
This proposal has been superseded by a proposal from 2015-10-05.
Commit Message
Fix markdown indentation, make pep8 and pyflakes3 happy.
Description of the Change
| Daniel Holbach (dholbach) wrote : | # |
Done.
| Snappy Tarmac (snappydevtarmac) wrote : | # |
Attempt to merge into lp:snapcraft failed due to conflicts:
text conflict in snapcraft/cmds.py
| Snappy Tarmac (snappydevtarmac) wrote : | # |
The attempt to merge lp:~dholbach/snapcraft/fix-pep8-and-doc-indentation into lp:snapcraft failed. Below is the output from the failed tests.
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
snapcraft/
| Daniel Holbach (dholbach) wrote : | # |
Could this be tarmac is using an old pep8?
| Daniel Holbach (dholbach) wrote : | # |
<dholbach> elopio, do you know which version of pep8 is running on the tarmac instance? (https:/
<elopio> dholbach: let me check.
<elopio> dholbach: 1.4.6-1.1build1
<dholbach> ah, ok, so that's trusty's pep8...
<elopio> dholbach: yes, tarmac is trusty.
| Snappy Tarmac (snappydevtarmac) wrote : | # |
The attempt to merge lp:~dholbach/snapcraft/fix-pep8-and-doc-indentation into lp:snapcraft failed. Below is the output from the failed tests.
snapcraft/
Unmerged revisions
Preview Diff
| 1 | === modified file 'docs/snapcraft-advanced-features.md' |
| 2 | --- docs/snapcraft-advanced-features.md 2015-10-01 08:54:15 +0000 |
| 3 | +++ docs/snapcraft-advanced-features.md 2015-10-05 16:56:41 +0000 |
| 4 | @@ -74,11 +74,11 @@ |
| 5 | assemble and build the snap: |
| 6 | |
| 7 | parts: |
| 8 | - spongeshaker: |
| 9 | + spongeshaker: |
| 10 | plugin: python2 |
| 11 | source: git://github.com/markokr/spongeshaker.git |
| 12 | make-project: |
| 13 | - plugin: make |
| 14 | + plugin: make |
| 15 | source: . |
| 16 | |
| 17 | The example above mixes and matches parts of different origin. Locally it |
| 18 | |
| 19 | === modified file 'examples/py2-project/sha3sum.py' |
| 20 | --- examples/py2-project/sha3sum.py 2015-07-17 14:44:45 +0000 |
| 21 | +++ examples/py2-project/sha3sum.py 2015-10-05 16:56:41 +0000 |
| 22 | @@ -12,4 +12,3 @@ |
| 23 | data = fp.read() |
| 24 | h.update(data) |
| 25 | print(h.hexdigest()) |
| 26 | - |
| 27 | |
| 28 | === modified file 'examples/py3-project/sha3sum.py' |
| 29 | --- examples/py3-project/sha3sum.py 2015-07-15 09:55:27 +0000 |
| 30 | +++ examples/py3-project/sha3sum.py 2015-10-05 16:56:41 +0000 |
| 31 | @@ -12,4 +12,3 @@ |
| 32 | data = fp.read() |
| 33 | h.update(data) |
| 34 | print(h.hexdigest()) |
| 35 | - |
| 36 | |
| 37 | === modified file 'examples/webcam-webui/config.py' |
| 38 | --- examples/webcam-webui/config.py 2015-09-15 20:53:36 +0000 |
| 39 | +++ examples/webcam-webui/config.py 2015-10-05 16:56:41 +0000 |
| 40 | @@ -17,7 +17,8 @@ |
| 41 | if config_yaml: |
| 42 | set_config(config_file, config_yaml) |
| 43 | |
| 44 | - yaml.dump(get_config(config_file), stream=sys.stdout, default_flow_style=False) |
| 45 | + yaml.dump(get_config(config_file), stream=sys.stdout, |
| 46 | + default_flow_style=False) |
| 47 | |
| 48 | |
| 49 | def set_config(config_file, config_yaml={}): |
| 50 | @@ -37,9 +38,11 @@ |
| 51 | |
| 52 | def _config(config_yaml={}): |
| 53 | try: |
| 54 | - interval_value = config_yaml['config'][os.environ['SNAP_NAME']]['interval'] |
| 55 | + interval_value = config_yaml['config'][ |
| 56 | + os.environ['SNAP_NAME']]['interval'] |
| 57 | if not isinstance(interval_value, int): |
| 58 | - config_yaml['config'][os.environ['SNAP_NAME']]['interval'] = _DEFAULT_INTERVAL |
| 59 | + config_yaml['config'][ |
| 60 | + os.environ['SNAP_NAME']]['interval'] = _DEFAULT_INTERVAL |
| 61 | except KeyError: |
| 62 | interval = { |
| 63 | 'config': { |
| 64 | |
| 65 | === modified file 'integration-tests/data/pypi-config/config.py' |
| 66 | --- integration-tests/data/pypi-config/config.py 2015-09-17 19:05:20 +0000 |
| 67 | +++ integration-tests/data/pypi-config/config.py 2015-10-05 16:56:41 +0000 |
| 68 | @@ -17,7 +17,9 @@ |
| 69 | if config_yaml: |
| 70 | set_config(config_file, config_yaml) |
| 71 | |
| 72 | - yaml.dump(get_config(config_file), stream=sys.stdout, default_flow_style=False) |
| 73 | + yaml.dump(get_config(config_file), |
| 74 | + stream=sys.stdout, |
| 75 | + default_flow_style=False) |
| 76 | |
| 77 | |
| 78 | def set_config(config_file, config_yaml={}): |
| 79 | @@ -37,9 +39,11 @@ |
| 80 | |
| 81 | def _config(config_yaml={}): |
| 82 | try: |
| 83 | - interval_value = config_yaml['config'][os.environ['SNAP_NAME']]['interval'] |
| 84 | + interval_value = config_yaml['config'][ |
| 85 | + os.environ['SNAP_NAME']]['interval'] |
| 86 | if not isinstance(interval_value, int): |
| 87 | - config_yaml['config'][os.environ['SNAP_NAME']]['interval'] = _DEFAULT_INTERVAL |
| 88 | + config_yaml['config'][ |
| 89 | + os.environ['SNAP_NAME']]['interval'] = _DEFAULT_INTERVAL |
| 90 | except KeyError: |
| 91 | interval = { |
| 92 | 'config': { |
| 93 | |
| 94 | === modified file 'runtests.sh' |
| 95 | --- runtests.sh 2015-10-02 02:24:13 +0000 |
| 96 | +++ runtests.sh 2015-10-05 16:56:41 +0000 |
| 97 | @@ -48,7 +48,7 @@ |
| 98 | # These three checks could easily be done with flake8 in one shot if |
| 99 | # we had python3-flake8 provide flake8 |
| 100 | # Ignore 501 (line-too-long) |
| 101 | - pep8 $SRC_PATHS --ignore=E501 |
| 102 | + pep8 $SRC_PATHS |
| 103 | |
| 104 | pyflakes3 $SRC_PATHS |
| 105 | |
| 106 | |
| 107 | === modified file 'setup.py' |
| 108 | --- setup.py 2015-09-02 15:10:58 +0000 |
| 109 | +++ setup.py 2015-10-05 16:56:41 +0000 |
| 110 | @@ -37,8 +37,10 @@ |
| 111 | package_data={'snapcraft': ['manifest.txt']}, |
| 112 | scripts=['bin/snapcraft'], |
| 113 | data_files=[ |
| 114 | - ('share/snapcraft/plugins', ['plugins/' + x for x in os.listdir('plugins')]), |
| 115 | - ('share/snapcraft/schema', ['schema/' + x for x in os.listdir('schema')]), |
| 116 | + ('share/snapcraft/plugins', |
| 117 | + ['plugins/' + x for x in os.listdir('plugins')]), |
| 118 | + ('share/snapcraft/schema', |
| 119 | + ['schema/' + x for x in os.listdir('schema')]), |
| 120 | ], |
| 121 | cmdclass={'test': TestCommand}, |
| 122 | ) |
| 123 | |
| 124 | === modified file 'snapcraft/__init__.py' |
| 125 | --- snapcraft/__init__.py 2015-09-29 08:37:47 +0000 |
| 126 | +++ snapcraft/__init__.py 2015-10-05 16:56:41 +0000 |
| 127 | @@ -42,8 +42,10 @@ |
| 128 | self.partdir = os.path.join(os.getcwd(), "parts", self.name) |
| 129 | self.sourcedir = os.path.join(os.getcwd(), "parts", self.name, "src") |
| 130 | self.builddir = os.path.join(os.getcwd(), "parts", self.name, "build") |
| 131 | - self.ubuntudir = os.path.join(os.getcwd(), "parts", self.name, 'ubuntu') |
| 132 | - self.installdir = os.path.join(os.getcwd(), "parts", self.name, "install") |
| 133 | + self.ubuntudir = os.path.join(os.getcwd(), "parts", self.name, |
| 134 | + 'ubuntu') |
| 135 | + self.installdir = os.path.join(os.getcwd(), "parts", self.name, |
| 136 | + "install") |
| 137 | self.stagedir = os.path.join(os.getcwd(), "stage") |
| 138 | self.snapdir = os.path.join(os.getcwd(), "snap") |
| 139 | |
| 140 | @@ -84,17 +86,23 @@ |
| 141 | def isurl(self, url): |
| 142 | return snapcraft.common.isurl(url) |
| 143 | |
| 144 | - def get_source(self, source, source_type=None, source_tag=None, source_branch=None): |
| 145 | + def get_source(self, source, source_type=None, source_tag=None, |
| 146 | + source_branch=None): |
| 147 | try: |
| 148 | handler_class = _get_source_handler(source_type, source) |
| 149 | except ValueError: |
| 150 | - logger.error("Unrecognized source '%s' for part '%s'.", source, self.name) |
| 151 | + logger.error("Unrecognized source '%s' for part '%s'.", source, |
| 152 | + self.name) |
| 153 | snapcraft.common.fatal() |
| 154 | |
| 155 | try: |
| 156 | - handler = handler_class(source, self.sourcedir, source_tag, source_branch) |
| 157 | + handler = handler_class(source, self.sourcedir, source_tag, |
| 158 | + source_branch) |
| 159 | except snapcraft.sources.IncompatibleOptionsError as e: |
| 160 | - logger.error('Issues while setting up sources for part \'%s\': %s.', self.name, e.message) |
| 161 | + logger.error( |
| 162 | + 'Issues while setting up sources for part \'%s\': %s.', |
| 163 | + self.name, |
| 164 | + e.message) |
| 165 | snapcraft.common.fatal() |
| 166 | if not handler.pull(): |
| 167 | return False |
| 168 | @@ -115,16 +123,23 @@ |
| 169 | def setup_stage_packages(self): |
| 170 | part_stage_packages = getattr(self.options, 'stage_packages', []) or [] |
| 171 | if self.PLUGIN_STAGE_PACKAGES or part_stage_packages: |
| 172 | - ubuntu = snapcraft.repo.Ubuntu(self.ubuntudir, sources=self.PLUGIN_STAGE_SOURCES) |
| 173 | + ubuntu = snapcraft.repo.Ubuntu(self.ubuntudir, |
| 174 | + sources=self.PLUGIN_STAGE_SOURCES) |
| 175 | ubuntu.get(self.PLUGIN_STAGE_PACKAGES + part_stage_packages) |
| 176 | ubuntu.unpack(self.installdir) |
| 177 | self._fixup(self.installdir) |
| 178 | |
| 179 | def _fixup(self, root): |
| 180 | if os.path.isfile(os.path.join(root, 'usr', 'bin', 'xml2-config')): |
| 181 | - self.run(['sed', '-i', '-e', 's|prefix=/usr|prefix={}/usr|'.format(root), os.path.join(root, 'usr', 'bin', 'xml2-config')]) |
| 182 | + self.run( |
| 183 | + ['sed', '-i', '-e', 's|prefix=/usr|prefix={}/usr|'. |
| 184 | + format(root), |
| 185 | + os.path.join(root, 'usr', 'bin', 'xml2-config')]) |
| 186 | if os.path.isfile(os.path.join(root, 'usr', 'bin', 'xslt-config')): |
| 187 | - self.run(['sed', '-i', '-e', 's|prefix=/usr|prefix={}/usr|'.format(root), os.path.join(root, 'usr', 'bin', 'xslt-config')]) |
| 188 | + self.run( |
| 189 | + ['sed', '-i', '-e', 's|prefix=/usr|prefix={}/usr|'. |
| 190 | + format(root), |
| 191 | + os.path.join(root, 'usr', 'bin', 'xslt-config')]) |
| 192 | |
| 193 | |
| 194 | def _get_source_handler(source_type, source): |
| 195 | |
| 196 | === modified file 'snapcraft/cmds.py' |
| 197 | --- snapcraft/cmds.py 2015-10-04 20:03:23 +0000 |
| 198 | +++ snapcraft/cmds.py 2015-10-05 16:56:41 +0000 |
| 199 | @@ -54,7 +54,8 @@ |
| 200 | if args.part: |
| 201 | yaml += 'parts:\n' |
| 202 | for part_name in args.part: |
| 203 | - part = snapcraft.plugin.load_plugin(part_name, part_name, load_code=False) |
| 204 | + part = snapcraft.plugin.load_plugin(part_name, part_name, |
| 205 | + load_code=False) |
| 206 | yaml += ' ' + part.names()[0] + ':\n' |
| 207 | for opt in part.config.get('options', []): |
| 208 | if part.config['options'][opt].get('required', False): |
| 209 | @@ -73,7 +74,10 @@ |
| 210 | common.env = config.stage_env() |
| 211 | userCommand = args.userCommand |
| 212 | if not userCommand: |
| 213 | - userCommand = ['/usr/bin/env', 'PS1=\[\e[1;32m\]snapcraft:\w\$\[\e[0m\] ', '/bin/bash', '--norc'] |
| 214 | + userCommand = ['/usr/bin/env', |
| 215 | + 'PS1=\[\e[1;32m\]snapcraft:\w\$\[\e[0m\] ', |
| 216 | + '/bin/bash', |
| 217 | + '--norc'] |
| 218 | common.run(userCommand) |
| 219 | |
| 220 | |
| 221 | @@ -168,7 +172,8 @@ |
| 222 | qemu_img = os.path.join(qemudir, "15.04.img") |
| 223 | if not os.path.exists(qemu_img): |
| 224 | os.makedirs(qemudir, exist_ok=True) |
| 225 | - logger.info('Setting up virtual snappy environment, root access required') |
| 226 | + logger.info( |
| 227 | + 'Setting up virtual snappy environment, root access required') |
| 228 | common.run([ |
| 229 | 'sudo', 'ubuntu-device-flash', 'core', '15.04', '--developer-mode', |
| 230 | '--enable-ssh', '-o', os.path.relpath(qemu_img, qemudir)], |
| 231 | @@ -181,7 +186,8 @@ |
| 232 | # the snapcraft run workflow. |
| 233 | # |
| 234 | # For example: |
| 235 | - # $ export SNAPCRAFT_RUN_QEMU_ARGS="-usb -device usb-host,hostbus=1,hostaddr=10" |
| 236 | + # $ export SNAPCRAFT_RUN_QEMU_ARGS=\ |
| 237 | + # "-usb -device usb-host,hostbus=1,hostaddr=10" |
| 238 | # $ snapcraft run |
| 239 | qemu_args = os.getenv("SNAPCRAFT_RUN_QEMU_ARGS") |
| 240 | if qemu_args is not None: |
| 241 | @@ -258,7 +264,9 @@ |
| 242 | for part in parts: |
| 243 | # Gather our own files up |
| 244 | fileset = getattr(part.code.options, 'stage', ['*']) or ['*'] |
| 245 | - part_files, _ = snapcraft.plugin.migratable_filesets(fileset, part.installdir) |
| 246 | + part_files, _ = snapcraft.plugin.migratable_filesets( |
| 247 | + fileset, |
| 248 | + part.installdir) |
| 249 | |
| 250 | # Scan previous parts for collisions |
| 251 | for other_part_name in parts_files: |
| 252 | @@ -266,19 +274,27 @@ |
| 253 | conflict_files = [] |
| 254 | for f in common: |
| 255 | this = os.path.join(part.installdir, f) |
| 256 | - other = os.path.join(parts_files[other_part_name]['installdir'], f) |
| 257 | + other = os.path.join( |
| 258 | + parts_files[other_part_name]['installdir'], |
| 259 | + f) |
| 260 | if os.path.islink(this) and os.path.islink(other): |
| 261 | continue |
| 262 | if not filecmp.cmp(this, other, shallow=False): |
| 263 | conflict_files.append(f) |
| 264 | |
| 265 | if conflict_files: |
| 266 | - logger.error('Error: parts %s and %s have the following file paths in common which have different contents:\n %s', other_part_name, part.names()[0], '\n '.join(sorted(conflict_files))) |
| 267 | + logger.error('Error: parts %s and %s have the following file ' |
| 268 | + 'paths in common which have different ' |
| 269 | + 'contents:\n %s', |
| 270 | + other_part_name, |
| 271 | + part.names()[0], |
| 272 | + '\n '.join(sorted(conflict_files))) |
| 273 | |
| 274 | return False |
| 275 | |
| 276 | # And add our files to the list |
| 277 | - parts_files[part.names()[0]] = {'files': part_files, 'installdir': part.installdir} |
| 278 | + parts_files[part.names()[0]] = {'files': part_files, |
| 279 | + 'installdir': part.installdir} |
| 280 | |
| 281 | return True |
| 282 | |
| 283 | @@ -305,9 +321,9 @@ |
| 284 | # This ends up running multiple times, as each part gets to its |
| 285 | # staging cmd. That's inefficient, but largely OK. |
| 286 | # FIXME: fix the above by iterating over cmds before iterating |
| 287 | - # all_parts. But then we need to make sure we continue to handle |
| 288 | - # cases like go, where you want go built before trying to pull |
| 289 | - # a go project. |
| 290 | + # all_parts. But then we need to make sure we continue to |
| 291 | + # handle cases like go, where you want go built before trying |
| 292 | + # to pull a go project. |
| 293 | if not _check_for_collisions(config.all_parts): |
| 294 | sys.exit(1) |
| 295 | |
| 296 | @@ -337,7 +353,9 @@ |
| 297 | def _install_build_packages(packages): |
| 298 | new_packages = [] |
| 299 | for check_pkg in packages: |
| 300 | - if subprocess.call(['dpkg-query', '-s', check_pkg], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) != 0: |
| 301 | + if subprocess.call(['dpkg-query', '-s', check_pkg], |
| 302 | + stdout=subprocess.DEVNULL, |
| 303 | + stderr=subprocess.DEVNULL) != 0: |
| 304 | new_packages.append(check_pkg) |
| 305 | if new_packages: |
| 306 | logger.info('Installing required packages on the host system') |
| 307 | @@ -361,8 +379,9 @@ |
| 308 | return _config |
| 309 | except snapcraft.yaml.SnapcraftYamlFileError as e: |
| 310 | logger.error( |
| 311 | - 'Could not find {}. Are you sure you are in the right directory?\n' |
| 312 | - 'To start a new project, use \'snapcraft init\''.format(e.file)) |
| 313 | + 'Could not find {}. Are you sure you are in the right ' |
| 314 | + 'directory?\nTo start a new project, use \'snapcraft ' |
| 315 | + 'init\''.format(e.file)) |
| 316 | sys.exit(1) |
| 317 | except snapcraft.yaml.SnapcraftSchemaError as e: |
| 318 | msg = "Issues while validating snapcraft.yaml: {}".format(e.message) |
| 319 | @@ -374,5 +393,6 @@ |
| 320 | 'missing for the "{}" part.'.format(e.part)) |
| 321 | sys.exit(1) |
| 322 | except snapcraft.yaml.SnapcraftLogicError as e: |
| 323 | - logger.error('Issue detected while analyzing snapcraft.yaml: {}'.format(e.message)) |
| 324 | + logger.error('Issue detected while analyzing ' |
| 325 | + 'snapcraft.yaml: {}'.format(e.message)) |
| 326 | sys.exit(1) |
| 327 | |
| 328 | === modified file 'snapcraft/common.py' |
| 329 | --- snapcraft/common.py 2015-09-18 21:23:40 +0000 |
| 330 | +++ snapcraft/common.py 2015-10-05 16:56:41 +0000 |
| 331 | @@ -57,7 +57,8 @@ |
| 332 | f.write('\n') |
| 333 | f.write('exec $*') |
| 334 | f.flush() |
| 335 | - return subprocess.check_output(['/bin/sh', f.name] + cmd, **kwargs).decode('utf8').strip() |
| 336 | + return subprocess.check_output(['/bin/sh', f.name] + cmd, |
| 337 | + **kwargs).decode('utf8').strip() |
| 338 | |
| 339 | |
| 340 | def fatal(): |
| 341 | @@ -67,14 +68,17 @@ |
| 342 | def get_arch(): |
| 343 | global _arch |
| 344 | if _arch is None: |
| 345 | - _arch = subprocess.check_output(['dpkg-architecture', '-qDEB_BUILD_ARCH']).decode('utf8').strip() |
| 346 | + _arch = subprocess.check_output( |
| 347 | + ['dpkg-architecture', '-qDEB_BUILD_ARCH']).decode('utf8').strip() |
| 348 | return _arch |
| 349 | |
| 350 | |
| 351 | def get_arch_triplet(): |
| 352 | global _arch_triplet |
| 353 | if _arch_triplet is None: |
| 354 | - _arch_triplet = subprocess.check_output(['dpkg-architecture', '-qDEB_BUILD_MULTIARCH']).decode('utf8').strip() |
| 355 | + _arch_triplet = subprocess.check_output( |
| 356 | + ['dpkg-architecture', '-qDEB_BUILD_MULTIARCH']), |
| 357 | + decode('utf8').strip() |
| 358 | return _arch_triplet |
| 359 | |
| 360 | |
| 361 | |
| 362 | === modified file 'snapcraft/main.py' |
| 363 | --- snapcraft/main.py 2015-09-17 14:14:14 +0000 |
| 364 | +++ snapcraft/main.py 2015-10-05 16:56:41 +0000 |
| 365 | @@ -30,9 +30,11 @@ |
| 366 | # Parent parsers |
| 367 | |
| 368 | force_parser = argparse.ArgumentParser(add_help=False) |
| 369 | - force_parser.add_argument('--force', action='store_true', help='redo all steps for all parts') |
| 370 | + force_parser.add_argument('--force', action='store_true', |
| 371 | + help='redo all steps for all parts') |
| 372 | |
| 373 | - cmd_parser = argparse.ArgumentParser(add_help=False, parents=[force_parser]) |
| 374 | + cmd_parser = argparse.ArgumentParser(add_help=False, |
| 375 | + parents=[force_parser]) |
| 376 | cmd_parser.add_argument('part', nargs='*') |
| 377 | |
| 378 | # Command parsers |
| 379 | @@ -42,28 +44,44 @@ |
| 380 | parser.set_defaults(func=snapcraft.cmds.init) |
| 381 | |
| 382 | parser = subparsers.add_parser('shell', help='enter staging environment') |
| 383 | - parser.add_argument('userCommand', nargs=argparse.REMAINDER, metavar='cmd', help='optional command to run inside staging environment') |
| 384 | + parser.add_argument( |
| 385 | + 'userCommand', nargs=argparse.REMAINDER, |
| 386 | + metavar='cmd', |
| 387 | + help='optional command to run inside staging environment') |
| 388 | parser.set_defaults(func=snapcraft.cmds.shell) |
| 389 | |
| 390 | - parser = subparsers.add_parser('run', help='run snap in kvm', add_help=False) |
| 391 | + parser = subparsers.add_parser('run', help='run snap in kvm', |
| 392 | + add_help=False) |
| 393 | parser.set_defaults(func=snapcraft.cmds.run) |
| 394 | |
| 395 | - parser = subparsers.add_parser('clean', help='clean up the environment (to start from scratch)') |
| 396 | + parser = subparsers.add_parser( |
| 397 | + 'clean', |
| 398 | + help='clean up the environment (to start from scratch)') |
| 399 | parser.set_defaults(func=snapcraft.cmds.clean) |
| 400 | |
| 401 | - parser = subparsers.add_parser('pull', help='get sources', parents=[cmd_parser]) |
| 402 | - parser.set_defaults(func=snapcraft.cmds.cmd) |
| 403 | - |
| 404 | - parser = subparsers.add_parser('build', help='build parts', parents=[cmd_parser]) |
| 405 | - parser.set_defaults(func=snapcraft.cmds.cmd) |
| 406 | - |
| 407 | - parser = subparsers.add_parser('stage', help='put parts into staging area', parents=[cmd_parser]) |
| 408 | - parser.set_defaults(func=snapcraft.cmds.cmd) |
| 409 | - |
| 410 | - parser = subparsers.add_parser('snap', help='put parts into snap area', parents=[cmd_parser]) |
| 411 | + parser = subparsers.add_parser('pull', help='get sources', |
| 412 | + parents=[cmd_parser]) |
| 413 | + parser.set_defaults(func=snapcraft.cmds.cmd) |
| 414 | + |
| 415 | + parser = subparsers.add_parser('build', help='build parts', |
| 416 | + parents=[cmd_parser]) |
| 417 | + parser.set_defaults(func=snapcraft.cmds.cmd) |
| 418 | + |
| 419 | + parser = subparsers.add_parser( |
| 420 | + 'stage', |
| 421 | + help='put parts into staging area', parents=[cmd_parser]) |
| 422 | + parser.set_defaults(func=snapcraft.cmds.cmd) |
| 423 | + |
| 424 | + parser = subparsers.add_parser( |
| 425 | + 'snap', |
| 426 | + help='put parts into snap area', |
| 427 | + parents=[cmd_parser]) |
| 428 | parser.set_defaults(func=snapcraft.cmds.snap) |
| 429 | |
| 430 | - parser = subparsers.add_parser('assemble', help='make snap package', parents=[force_parser], aliases=['all']) |
| 431 | + parser = subparsers.add_parser( |
| 432 | + 'assemble', |
| 433 | + help='make snap package', parents=[force_parser], |
| 434 | + aliases=['all']) |
| 435 | parser.set_defaults(func=snapcraft.cmds.assemble) |
| 436 | |
| 437 | # Now run parser |
| 438 | |
| 439 | === modified file 'snapcraft/meta.py' |
| 440 | --- snapcraft/meta.py 2015-09-30 09:19:00 +0000 |
| 441 | +++ snapcraft/meta.py 2015-10-05 16:56:41 +0000 |
| 442 | @@ -91,7 +91,8 @@ |
| 443 | args = execparts[1:] if len(execparts) > 1 else [] |
| 444 | |
| 445 | config_hook_path = os.path.join(hooks_dir, 'config') |
| 446 | - _write_wrap_exe(execparts[0], config_hook_path, args=args, cwd='$SNAP_APP_PATH') |
| 447 | + _write_wrap_exe(execparts[0], config_hook_path, args=args, |
| 448 | + cwd='$SNAP_APP_PATH') |
| 449 | |
| 450 | |
| 451 | def _copy(meta_dir, relpath, new_relpath=None): |
| 452 | @@ -110,8 +111,10 @@ |
| 453 | for runnable in runnables: |
| 454 | for entry in ('security-policy', 'security-override'): |
| 455 | if entry in runnable: |
| 456 | - runnable[entry]['apparmor'] = _copy(meta_dir, runnable[entry]['apparmor']) |
| 457 | - runnable[entry]['seccomp'] = _copy(meta_dir, runnable[entry]['seccomp']) |
| 458 | + runnable[entry]['apparmor'] = \ |
| 459 | + _copy(meta_dir, runnable[entry]['apparmor']) |
| 460 | + runnable[entry]['seccomp'] = \ |
| 461 | + _copy(meta_dir, runnable[entry]['seccomp']) |
| 462 | |
| 463 | return runnables |
| 464 | |
| 465 | @@ -140,12 +143,14 @@ |
| 466 | if 'binaries' in config_data: |
| 467 | binaries = config_data['binaries'] |
| 468 | binaries = _wrap_binaries(binaries) |
| 469 | - package_yaml['binaries'] = _copy_security_profiles(meta_dir, _repack_names(binaries)) |
| 470 | + package_yaml['binaries'] = \ |
| 471 | + _copy_security_profiles(meta_dir, _repack_names(binaries)) |
| 472 | |
| 473 | if 'services' in config_data: |
| 474 | services = config_data['services'] |
| 475 | services = _wrap_services(services) |
| 476 | - package_yaml['services'] = _copy_security_profiles(meta_dir, _repack_names(services)) |
| 477 | + package_yaml['services'] = \ |
| 478 | + _copy_security_profiles(meta_dir, _repack_names(services)) |
| 479 | |
| 480 | return package_yaml |
| 481 | |
| 482 | @@ -159,7 +164,8 @@ |
| 483 | |
| 484 | |
| 485 | def _compose_readme(config_data): |
| 486 | - return '{config[summary]}\n{config[description]}\n'.format(config=config_data) |
| 487 | + s = '{config[summary]}\n{config[description]}\n' |
| 488 | + return s.format(config=config_data) |
| 489 | |
| 490 | |
| 491 | def _replace_cmd(execparts, cmd): |
| 492 | @@ -199,7 +205,8 @@ |
| 493 | wrapexec = '$SNAP_APP_PATH/{}'.format(relexepath) |
| 494 | if not os.path.exists(exepath) and '/' not in relexepath: |
| 495 | # If it doesn't exist it might be in the path |
| 496 | - logger.debug('Checking to see if "{}" is in the $PATH'.format(relexepath)) |
| 497 | + logger.debug('Checking to see if "{}" is in the $PATH'.format( |
| 498 | + relexepath)) |
| 499 | with tempfile.NamedTemporaryFile('w+') as tempf: |
| 500 | script = ('#!/bin/sh\n' + |
| 501 | '{}\n'.format(common.assemble_env()) + |
| 502 | @@ -209,7 +216,8 @@ |
| 503 | if common.run(['/bin/sh', tempf.name], cwd=snap_dir): |
| 504 | wrapexec = relexepath |
| 505 | else: |
| 506 | - logger.warning('Warning: unable to find "{}" in the path'.format(relexepath)) |
| 507 | + logger.warning('Warning: unable to find "{}" in the path'. |
| 508 | + format(relexepath)) |
| 509 | |
| 510 | _write_wrap_exe(wrapexec, wrappath) |
| 511 | |
| 512 | |
| 513 | === modified file 'snapcraft/plugin.py' |
| 514 | --- snapcraft/plugin.py 2015-09-22 10:39:06 +0000 |
| 515 | +++ snapcraft/plugin.py 2015-10-05 16:56:41 +0000 |
| 516 | @@ -49,7 +49,8 @@ |
| 517 | |
| 518 | class PluginHandler: |
| 519 | |
| 520 | - def __init__(self, name, part_name, properties, load_code=True, load_config=True): |
| 521 | + def __init__(self, name, part_name, properties, load_code=True, |
| 522 | + load_config=True): |
| 523 | self.valid = False |
| 524 | self.code = None |
| 525 | self.config = {} |
| 526 | @@ -107,7 +108,8 @@ |
| 527 | setattr(options, attrname, properties[opt]) |
| 528 | else: |
| 529 | if opt_parameters.get('required', False): |
| 530 | - raise PluginError('Required field {} missing on part {}'.format(opt, name)) |
| 531 | + raise PluginError('Required field {} missing on part {}'. |
| 532 | + format(opt, name)) |
| 533 | setattr(options, attrname, None) |
| 534 | |
| 535 | return options |
| 536 | @@ -117,7 +119,8 @@ |
| 537 | module_name = name.replace('-', '_') |
| 538 | |
| 539 | try: |
| 540 | - module = importlib.import_module('snapcraft.plugins.' + module_name) |
| 541 | + module = importlib.import_module('snapcraft.plugins.' + |
| 542 | + module_name) |
| 543 | except ImportError: |
| 544 | module = None |
| 545 | |
| 546 | @@ -160,7 +163,8 @@ |
| 547 | try: |
| 548 | with open(self.statefile, 'r') as f: |
| 549 | lastStep = f.read() |
| 550 | - return common.COMMAND_ORDER.index(stage) > common.COMMAND_ORDER.index(lastStep) |
| 551 | + return (common.COMMAND_ORDER.index(stage) > |
| 552 | + common.COMMAND_ORDER.index(lastStep)) |
| 553 | except Exception: |
| 554 | return True |
| 555 | |
| 556 | @@ -179,7 +183,8 @@ |
| 557 | return True |
| 558 | self.makedirs() |
| 559 | |
| 560 | - run_setup_stage_packages = self.code and hasattr(self.code, 'setup_stage_packages') |
| 561 | + run_setup_stage_packages = self.code and \ |
| 562 | + hasattr(self.code, 'setup_stage_packages') |
| 563 | run_pull = self.code and hasattr(self.code, 'pull') |
| 564 | |
| 565 | if run_setup_stage_packages or run_pull: |
| 566 | @@ -248,7 +253,8 @@ |
| 567 | snap_files, snap_dirs = self._migratable_fileset_for('stage') |
| 568 | |
| 569 | try: |
| 570 | - _migrate_files(snap_files, snap_dirs, self.installdir, self.stagedir) |
| 571 | + _migrate_files(snap_files, snap_dirs, self.installdir, |
| 572 | + self.stagedir) |
| 573 | except FileNotFoundError as e: |
| 574 | logger.error('Could not find file %s defined in stage', |
| 575 | os.path.relpath(e.filename, os.path.curdir)) |
| 576 | @@ -284,7 +290,8 @@ |
| 577 | |
| 578 | |
| 579 | def load_plugin(part_name, plugin_name, properties={}, load_code=True): |
| 580 | - part = PluginHandler(plugin_name, part_name, properties, load_code=load_code) |
| 581 | + part = PluginHandler(plugin_name, part_name, properties, |
| 582 | + load_code=load_code) |
| 583 | if not part.is_valid(): |
| 584 | logger.error('Could not load part %s', plugin_name) |
| 585 | sys.exit(1) |
| 586 | @@ -300,10 +307,13 @@ |
| 587 | # And chop files, including whole trees if any dirs are mentioned |
| 588 | snap_files = include_files - exclude_files |
| 589 | for exclude_dir in exclude_dirs: |
| 590 | - snap_files = set([x for x in snap_files if not x.startswith(exclude_dir + '/')]) |
| 591 | + snap_files = set([x for x in snap_files |
| 592 | + if not x.startswith(exclude_dir + '/')]) |
| 593 | |
| 594 | # Separate dirs from files |
| 595 | - snap_dirs = set([x for x in snap_files if os.path.isdir(os.path.join(srcdir, x)) and not os.path.islink(os.path.join(srcdir, x))]) |
| 596 | + snap_dirs = set([x for x in snap_files |
| 597 | + if os.path.isdir(os.path.join(srcdir, x)) and |
| 598 | + not os.path.islink(os.path.join(srcdir, x))]) |
| 599 | snap_files = snap_files - snap_dirs |
| 600 | |
| 601 | return snap_files, snap_dirs |
| 602 | @@ -356,8 +366,12 @@ |
| 603 | # files from an include like 'lib' |
| 604 | for include_dir in include_dirs: |
| 605 | for root, dirs, files in os.walk(include_dir): |
| 606 | - include_files |= set([os.path.relpath(os.path.join(root, d), directory) for d in dirs]) |
| 607 | - include_files |= set([os.path.relpath(os.path.join(root, f), directory) for f in files]) |
| 608 | + include_files |= \ |
| 609 | + set([os.path.relpath(os.path.join(root, d), directory) |
| 610 | + for d in dirs]) |
| 611 | + include_files |= \ |
| 612 | + set([os.path.relpath(os.path.join(root, f), directory) |
| 613 | + for f in files]) |
| 614 | |
| 615 | return include_files |
| 616 | |
| 617 | @@ -369,8 +383,10 @@ |
| 618 | matches = glob.glob(os.path.join(directory, exclude)) |
| 619 | exclude_files |= set(matches) |
| 620 | |
| 621 | - exclude_dirs = [os.path.relpath(x, directory) for x in exclude_files if os.path.isdir(x)] |
| 622 | - exclude_files = set([os.path.relpath(x, directory) for x in exclude_files]) |
| 623 | + exclude_dirs = [os.path.relpath(x, directory) |
| 624 | + for x in exclude_files if os.path.isdir(x)] |
| 625 | + exclude_files = set([os.path.relpath(x, directory) |
| 626 | + for x in exclude_files]) |
| 627 | |
| 628 | return exclude_files, exclude_dirs |
| 629 | |
| 630 | |
| 631 | === modified file 'snapcraft/plugins/ant.py' |
| 632 | --- snapcraft/plugins/ant.py 2015-10-01 08:54:15 +0000 |
| 633 | +++ snapcraft/plugins/ant.py 2015-10-05 16:56:41 +0000 |
| 634 | @@ -36,7 +36,8 @@ |
| 635 | return False |
| 636 | files = glob.glob(os.path.join(self.builddir, 'target', '*.jar')) |
| 637 | if not files: |
| 638 | - logger.error('Could not find any built jar files for part %s', self.name) |
| 639 | + logger.error('Could not find any built jar files for part %s', |
| 640 | + self.name) |
| 641 | sys.exit(1) |
| 642 | jardir = os.path.join(self.installdir, 'jar') |
| 643 | return self.run(['mkdir', '-p', jardir]) and \ |
| 644 | |
| 645 | === modified file 'snapcraft/plugins/autotools.py' |
| 646 | --- snapcraft/plugins/autotools.py 2015-10-01 08:54:15 +0000 |
| 647 | +++ snapcraft/plugins/autotools.py 2015-10-05 16:56:41 +0000 |
| 648 | @@ -28,5 +28,5 @@ |
| 649 | if not os.path.exists(os.path.join(self.builddir, "configure")): |
| 650 | if not self.run(['env', 'NOCONFIGURE=1', './autogen.sh']): |
| 651 | return False |
| 652 | - return self.run(['./configure', '--prefix='] + self.options.configflags) and \ |
| 653 | - super().build() |
| 654 | + return self.run(['./configure', '--prefix='] + |
| 655 | + self.options.configflags) and super().build() |
| 656 | |
| 657 | === modified file 'snapcraft/plugins/cmake.py' |
| 658 | --- snapcraft/plugins/cmake.py 2015-10-01 08:54:15 +0000 |
| 659 | +++ snapcraft/plugins/cmake.py 2015-10-05 16:56:41 +0000 |
| 660 | @@ -24,5 +24,5 @@ |
| 661 | self.options.configflags = [] |
| 662 | |
| 663 | def build(self): |
| 664 | - return self.run(['cmake', '.', '-DCMAKE_INSTALL_PREFIX='] + self.options.configflags) and \ |
| 665 | - super().build() |
| 666 | + return self.run(['cmake', '.', '-DCMAKE_INSTALL_PREFIX='] + |
| 667 | + self.options.configflags) and super().build() |
| 668 | |
| 669 | === modified file 'snapcraft/plugins/copy.py' |
| 670 | --- snapcraft/plugins/copy.py 2015-08-26 08:52:09 +0000 |
| 671 | +++ snapcraft/plugins/copy.py 2015-10-05 16:56:41 +0000 |
| 672 | @@ -37,5 +37,6 @@ |
| 673 | dst_dir = os.path.dirname(dst) |
| 674 | if not os.path.exists(dst_dir): |
| 675 | os.makedirs(dst_dir) |
| 676 | - res &= self.run(["cp", "--preserve=all", "-R", src, dst], cwd=os.getcwd()) |
| 677 | + res &= self.run(["cp", "--preserve=all", "-R", src, dst], |
| 678 | + cwd=os.getcwd()) |
| 679 | return res |
| 680 | |
| 681 | === modified file 'snapcraft/plugins/go.py' |
| 682 | --- snapcraft/plugins/go.py 2015-10-01 08:54:15 +0000 |
| 683 | +++ snapcraft/plugins/go.py 2015-10-05 16:56:41 +0000 |
| 684 | @@ -43,7 +43,8 @@ |
| 685 | return False |
| 686 | if not self.run(['go', 'install', self.fullname]): |
| 687 | return False |
| 688 | - return self.run(['cp', '-a', os.path.join(self.builddir, 'bin'), self.installdir]) |
| 689 | + return self.run(['cp', '-a', os.path.join(self.builddir, 'bin'), |
| 690 | + self.installdir]) |
| 691 | |
| 692 | def run(self, cmd, **kwargs): |
| 693 | cmd = ['env', 'GOPATH=' + self.builddir] + cmd |
| 694 | |
| 695 | === modified file 'snapcraft/plugins/maven.py' |
| 696 | --- snapcraft/plugins/maven.py 2015-10-01 08:54:15 +0000 |
| 697 | +++ snapcraft/plugins/maven.py 2015-10-05 16:56:41 +0000 |
| 698 | @@ -36,7 +36,8 @@ |
| 699 | jarfiles = glob.glob(os.path.join(self.builddir, 'target', '*.jar')) |
| 700 | warfiles = glob.glob(os.path.join(self.builddir, 'target', '*.war')) |
| 701 | if not (jarfiles or warfiles): |
| 702 | - logger.error('Could not find any built jar or war files for part %s', self.name) |
| 703 | + logger.error('Could not find any built jar or war files for ' |
| 704 | + 'part %s', self.name) |
| 705 | snapcraft.common.fatal() |
| 706 | if jarfiles: |
| 707 | jardir = os.path.join(self.installdir, 'jar') |
| 708 | |
| 709 | === modified file 'snapcraft/plugins/python2.py' |
| 710 | --- snapcraft/plugins/python2.py 2015-10-01 08:54:15 +0000 |
| 711 | +++ snapcraft/plugins/python2.py 2015-10-05 16:56:41 +0000 |
| 712 | @@ -62,7 +62,8 @@ |
| 713 | |
| 714 | if not os.path.exists(site_packages_dir): |
| 715 | os.symlink( |
| 716 | - os.path.join(prefix, 'lib', self.python_version, 'dist-packages'), |
| 717 | + os.path.join(prefix, 'lib', self.python_version, |
| 718 | + 'dist-packages'), |
| 719 | site_packages_dir) |
| 720 | |
| 721 | if not self.run(['python2', easy_install, '--prefix', prefix, 'pip']): |
| 722 | @@ -99,7 +100,8 @@ |
| 723 | @property |
| 724 | def dist_packages_dir(self): |
| 725 | return os.path.join( |
| 726 | - self.installdir, 'usr', 'lib', self.python_version, 'dist-packages') |
| 727 | + self.installdir, 'usr', 'lib', self.python_version, |
| 728 | + 'dist-packages') |
| 729 | |
| 730 | @property |
| 731 | def python_version(self): |
| 732 | |
| 733 | === modified file 'snapcraft/plugins/python3.py' |
| 734 | --- snapcraft/plugins/python3.py 2015-10-02 16:45:13 +0000 |
| 735 | +++ snapcraft/plugins/python3.py 2015-10-05 16:56:41 +0000 |
| 736 | @@ -99,7 +99,8 @@ |
| 737 | @property |
| 738 | def dist_packages_dir(self): |
| 739 | return os.path.join( |
| 740 | - self.installdir, 'usr', 'lib', self.python_version, 'dist-packages') |
| 741 | + self.installdir, 'usr', 'lib', self.python_version, |
| 742 | + 'dist-packages') |
| 743 | |
| 744 | @property |
| 745 | def python_version(self): |
| 746 | |
| 747 | === modified file 'snapcraft/plugins/qml.py' |
| 748 | --- snapcraft/plugins/qml.py 2015-09-08 21:21:07 +0000 |
| 749 | +++ snapcraft/plugins/qml.py 2015-10-05 16:56:41 +0000 |
| 750 | @@ -81,7 +81,8 @@ |
| 751 | "LD_LIBRARY_PATH=%s/usr/lib/%s:$LD_LIBRARY_PATH" % (root, arch), |
| 752 | # Mir config |
| 753 | "MIR_SOCKET=/run/mir_socket", |
| 754 | - "MIR_CLIENT_PLATFORM_PATH=%s/usr/lib/%s/mir/client-platform" % (root, arch), |
| 755 | + "MIR_CLIENT_PLATFORM_PATH={}/usr/lib/{}/mir/client-platform" |
| 756 | + .format(root, arch), |
| 757 | # XKB config |
| 758 | "XKB_CONFIG_ROOT=%s/usr/share/X11/xkb" % root, |
| 759 | # Qt Platform to Mir |
| 760 | @@ -89,14 +90,18 @@ |
| 761 | "QTCHOOSER_NO_GLOBAL_DIR=1", |
| 762 | "QT_SELECT=snappy-qt5", |
| 763 | # Qt Libs |
| 764 | - "LD_LIBRARY_PATH=%s/usr/lib/%s/qt5/libs:$LD_LIBRARY_PATH" % (root, arch), |
| 765 | - "LD_LIBRARY_PATH=%s/usr/lib/%s/pulseaudio:$LD_LIBRARY_PATH" % (root, arch), |
| 766 | + "LD_LIBRARY_PATH={}/usr/lib/{}/qt5/libs:$LD_LIBRARY_PATH" |
| 767 | + .format(root, arch), |
| 768 | + "LD_LIBRARY_PATH={}/usr/lib/{}/pulseaudio:$LD_LIBRARY_PATH" |
| 769 | + .format(root, arch), |
| 770 | # Qt Modules |
| 771 | "QT_PLUGIN_PATH=%s/usr/lib/%s/qt5/plugins" % (root, arch), |
| 772 | "QML2_IMPORT_PATH=%s/usr/lib/%s/qt5/qml" % (root, arch), |
| 773 | # Mesa Libs |
| 774 | - "LD_LIBRARY_PATH=%s/usr/lib/%s/mesa:$LD_LIBRARY_PATH" % (root, arch), |
| 775 | - "LD_LIBRARY_PATH=%s/usr/lib/%s/mesa-egl:$LD_LIBRARY_PATH" % (root, arch), |
| 776 | + "LD_LIBRARY_PATH={}/usr/lib/{}/mesa:$LD_LIBRARY_PATH" |
| 777 | + .format(root, arch), |
| 778 | + "LD_LIBRARY_PATH={}/usr/lib/{}/mesa-egl:$LD_LIBRARY_PATH" |
| 779 | + .format(root, arch), |
| 780 | # XDG Config |
| 781 | "XDG_CONFIG_DIRS=%s/etc/xdg:$XDG_CONFIG_DIRS" % root, |
| 782 | "XDG_CONFIG_DIRS=%s/usr/xdg:$XDG_CONFIG_DIRS" % root, |
| 783 | |
| 784 | === modified file 'snapcraft/repo.py' |
| 785 | --- snapcraft/repo.py 2015-09-30 17:23:17 +0000 |
| 786 | +++ snapcraft/repo.py 2015-10-05 16:56:41 +0000 |
| 787 | @@ -28,7 +28,8 @@ |
| 788 | |
| 789 | import snapcraft.common |
| 790 | |
| 791 | -_DEFAULT_SOURCES = '''deb http://${prefix}.ubuntu.com/${suffix}/ ${release} main restricted |
| 792 | +_DEFAULT_SOURCES = \ |
| 793 | + '''deb http://${prefix}.ubuntu.com/${suffix}/ ${release} main restricted |
| 794 | deb http://${prefix}.ubuntu.com/${suffix}/ ${release}-updates main restricted |
| 795 | deb http://${prefix}.ubuntu.com/${suffix}/ ${release} universe |
| 796 | deb http://${prefix}.ubuntu.com/${suffix}/ ${release}-updates universe |
| 797 | @@ -103,7 +104,8 @@ |
| 798 | skipped_essential.append(pkg.name) |
| 799 | pkg.mark_keep() |
| 800 | continue |
| 801 | - if (pkg.name in manifest_dep_names and pkg.name not in package_names): |
| 802 | + if (pkg.name in manifest_dep_names and |
| 803 | + pkg.name not in package_names): |
| 804 | skipped_blacklisted.append(pkg.name) |
| 805 | pkg.mark_keep() |
| 806 | continue |
| 807 | @@ -111,7 +113,8 @@ |
| 808 | if skipped_essential: |
| 809 | print('Skipping priority essential packages:', skipped_essential) |
| 810 | if skipped_blacklisted: |
| 811 | - print('Skipping blacklisted from manifest packages:', skipped_blacklisted) |
| 812 | + print('Skipping blacklisted from manifest packages:', |
| 813 | + skipped_blacklisted) |
| 814 | |
| 815 | # download the remaining ones with proper progress |
| 816 | apt.apt_pkg.config.set("Dir::Cache::Archives", self.downloaddir) |
| 817 | @@ -131,7 +134,8 @@ |
| 818 | def _manifest_dep_names(self): |
| 819 | manifest_dep_names = set() |
| 820 | |
| 821 | - with open(os.path.abspath(os.path.join(__file__, '..', 'manifest.txt'))) as f: |
| 822 | + with open(os.path.abspath(os.path.join(__file__, '..', |
| 823 | + 'manifest.txt'))) as f: |
| 824 | for line in f: |
| 825 | pkg = line.strip() |
| 826 | if pkg in self.apt_cache: |
| 827 | |
| 828 | === modified file 'snapcraft/sources.py' |
| 829 | --- snapcraft/sources.py 2015-09-29 08:11:32 +0000 |
| 830 | +++ snapcraft/sources.py 2015-10-05 16:56:41 +0000 |
| 831 | @@ -35,7 +35,8 @@ |
| 832 | |
| 833 | class Base: |
| 834 | |
| 835 | - def __init__(self, source, source_dir, source_tag=None, source_branch=None): |
| 836 | + def __init__(self, source, source_dir, source_tag=None, |
| 837 | + source_branch=None): |
| 838 | self.source = source |
| 839 | self.source_dir = source_dir |
| 840 | self.source_tag = source_tag |
| 841 | @@ -45,35 +46,43 @@ |
| 842 | raise NotImplementedError('this is just a base class') |
| 843 | |
| 844 | def provision(self, dst): |
| 845 | - return snapcraft.common.run(['cp', '-Trfa', self.source_dir, dst], cwd=os.getcwd()) |
| 846 | + return snapcraft.common.run(['cp', '-Trfa', self.source_dir, dst], |
| 847 | + cwd=os.getcwd()) |
| 848 | |
| 849 | |
| 850 | class Bazaar(Base): |
| 851 | |
| 852 | - def __init__(self, source, source_dir, source_tag=None, source_branch=None): |
| 853 | + def __init__(self, source, source_dir, source_tag=None, |
| 854 | + source_branch=None): |
| 855 | super().__init__(source, source_dir, source_tag, source_branch) |
| 856 | if source_branch: |
| 857 | - raise IncompatibleOptionsError('can\'t specify a source-branch for a bzr source') |
| 858 | + raise IncompatibleOptionsError( |
| 859 | + 'can\'t specify a source-branch for a bzr source') |
| 860 | |
| 861 | def pull(self): |
| 862 | tag_opts = [] |
| 863 | if self.source_tag: |
| 864 | tag_opts = ['-r', 'tag:' + self.source_tag] |
| 865 | if os.path.exists(os.path.join(self.source_dir, ".bzr")): |
| 866 | - cmd = ['bzr', 'pull'] + tag_opts + [self.source, '-d', self.source_dir] |
| 867 | + cmd = ['bzr', 'pull'] + tag_opts + \ |
| 868 | + [self.source, '-d', self.source_dir] |
| 869 | else: |
| 870 | os.rmdir(self.source_dir) |
| 871 | - cmd = ['bzr', 'branch'] + tag_opts + [self.source, self.source_dir] |
| 872 | + cmd = ['bzr', 'branch'] + tag_opts + \ |
| 873 | + [self.source, self.source_dir] |
| 874 | |
| 875 | return snapcraft.common.run(cmd, cwd=os.getcwd()) |
| 876 | |
| 877 | |
| 878 | class Git(Base): |
| 879 | |
| 880 | - def __init__(self, source, source_dir, source_tag=None, source_branch=None): |
| 881 | + def __init__(self, source, source_dir, source_tag=None, |
| 882 | + source_branch=None): |
| 883 | super().__init__(source, source_dir, source_tag, source_branch) |
| 884 | if source_tag and source_branch: |
| 885 | - raise IncompatibleOptionsError('can\'t specify both source-tag and source-branch for a git source') |
| 886 | + raise IncompatibleOptionsError( |
| 887 | + 'can\'t specify both source-tag and source-branch for ' |
| 888 | + 'a git source') |
| 889 | |
| 890 | def pull(self): |
| 891 | if os.path.exists(os.path.join(self.source_dir, ".git")): |
| 892 | @@ -86,18 +95,23 @@ |
| 893 | else: |
| 894 | branch_opts = [] |
| 895 | if self.source_tag or self.source_branch: |
| 896 | - branch_opts = ['--branch', self.source_tag or self.source_branch] |
| 897 | - cmd = ['git', 'clone'] + branch_opts + [self.source, self.source_dir] |
| 898 | + branch_opts = ['--branch', |
| 899 | + self.source_tag or self.source_branch] |
| 900 | + cmd = ['git', 'clone'] + branch_opts + \ |
| 901 | + [self.source, self.source_dir] |
| 902 | |
| 903 | return snapcraft.common.run(cmd, cwd=os.getcwd()) |
| 904 | |
| 905 | |
| 906 | class Mercurial(Base): |
| 907 | |
| 908 | - def __init__(self, source, source_dir, source_tag=None, source_branch=None): |
| 909 | + def __init__(self, source, source_dir, source_tag=None, |
| 910 | + source_branch=None): |
| 911 | super().__init__(source, source_dir, source_tag, source_branch) |
| 912 | if source_tag and source_branch: |
| 913 | - raise IncompatibleOptionsError('can\'t specify both source-tag and source-branch for a mercurial source') |
| 914 | + raise IncompatibleOptionsError( |
| 915 | + 'can\'t specify both source-tag and source-branch for a ' |
| 916 | + 'mercurial source') |
| 917 | |
| 918 | def pull(self): |
| 919 | if os.path.exists(os.path.join(self.source_dir, ".hg")): |
| 920 | @@ -118,23 +132,29 @@ |
| 921 | |
| 922 | class Tar(Base): |
| 923 | |
| 924 | - def __init__(self, source, source_dir, source_tag=None, source_branch=None): |
| 925 | + def __init__(self, source, source_dir, source_tag=None, |
| 926 | + source_branch=None): |
| 927 | super().__init__(source, source_dir, source_tag, source_branch) |
| 928 | if source_tag: |
| 929 | - raise IncompatibleOptionsError('can\'t specify a source-tag for a tar source') |
| 930 | + raise IncompatibleOptionsError( |
| 931 | + 'can\'t specify a source-tag for a tar source') |
| 932 | elif source_branch: |
| 933 | - raise IncompatibleOptionsError('can\'t specify a source-branch for a tar source') |
| 934 | + raise IncompatibleOptionsError( |
| 935 | + 'can\'t specify a source-branch for a tar source') |
| 936 | |
| 937 | def pull(self): |
| 938 | if snapcraft.common.isurl(self.source): |
| 939 | - return snapcraft.common.run(['wget', '-q', '-c', self.source], cwd=self.source_dir) |
| 940 | + return snapcraft.common.run(['wget', '-q', '-c', self.source], |
| 941 | + cwd=self.source_dir) |
| 942 | else: |
| 943 | return True |
| 944 | |
| 945 | def provision(self, dst, clean_target=True): |
| 946 | # TODO add unit tests. |
| 947 | if snapcraft.common.isurl(self.source): |
| 948 | - tarball = os.path.join(self.source_dir, os.path.basename(self.source)) |
| 949 | + tarball = os.path.join( |
| 950 | + self.source_dir, |
| 951 | + os.path.basename(self.source)) |
| 952 | else: |
| 953 | tarball = os.path.abspath(self.source) |
| 954 | |
| 955 | |
| 956 | === modified file 'snapcraft/tests/test_base_plugin.py' |
| 957 | --- snapcraft/tests/test_base_plugin.py 2015-09-29 08:37:47 +0000 |
| 958 | +++ snapcraft/tests/test_base_plugin.py 2015-10-05 16:56:41 +0000 |
| 959 | @@ -137,5 +137,6 @@ |
| 960 | self.assertEqual(raised.exception.code, 1, 'Wrong exit code returned.') |
| 961 | expected = ( |
| 962 | 'Issues while setting up sources for part \'test_plugin\': can\'t ' |
| 963 | - 'specify a {} for a {} source.\n'.format(self.error, self.source_type)) |
| 964 | + 'specify a {} for a {} source.\n' |
| 965 | + .format(self.error, self.source_type)) |
| 966 | self.assertEqual(expected, fake_logger.output) |
| 967 | |
| 968 | === modified file 'snapcraft/tests/test_cmds.py' |
| 969 | --- snapcraft/tests/test_cmds.py 2015-09-18 16:52:06 +0000 |
| 970 | +++ snapcraft/tests/test_cmds.py 2015-10-05 16:56:41 +0000 |
| 971 | @@ -73,7 +73,8 @@ |
| 972 | |
| 973 | self.assertFalse(cmds._check_for_collisions([part1, part2, part3])) |
| 974 | self.assertEqual( |
| 975 | - 'Error: parts part2 and part3 have the following file paths in common which have different contents:\n' |
| 976 | + 'Error: parts part2 and part3 have the following file paths in ' |
| 977 | + 'common which have different contents:\n' |
| 978 | ' 1\n' |
| 979 | ' a/2\n', |
| 980 | fake_logger.output) |
| 981 | |
| 982 | === modified file 'snapcraft/tests/test_copy_plugin.py' |
| 983 | --- snapcraft/tests/test_copy_plugin.py 2015-07-23 14:23:29 +0000 |
| 984 | +++ snapcraft/tests/test_copy_plugin.py 2015-10-05 16:56:41 +0000 |
| 985 | @@ -73,4 +73,5 @@ |
| 986 | |
| 987 | c = CopyPlugin("copy", self.mock_options) |
| 988 | self.assertTrue(c.build()) |
| 989 | - self.assertTrue(os.path.exists(os.path.join(self.dst_prefix, "dir/dst"))) |
| 990 | + self.assertTrue(os.path.exists(os.path.join(self.dst_prefix, |
| 991 | + "dir/dst"))) |
| 992 | |
| 993 | === modified file 'snapcraft/tests/test_meta.py' |
| 994 | --- snapcraft/tests/test_meta.py 2015-09-21 05:04:31 +0000 |
| 995 | +++ snapcraft/tests/test_meta.py 2015-10-05 16:56:41 +0000 |
| 996 | @@ -44,7 +44,8 @@ |
| 997 | } |
| 998 | |
| 999 | def test_plain_no_binaries_or_services(self): |
| 1000 | - y = meta._compose_package_yaml('meta', self.config_data, ['armhf', 'amd64']) |
| 1001 | + y = meta._compose_package_yaml('meta', self.config_data, |
| 1002 | + ['armhf', 'amd64']) |
| 1003 | |
| 1004 | expected = { |
| 1005 | 'name': 'my-package', |
| 1006 | @@ -74,7 +75,8 @@ |
| 1007 | 'binary2': {'exec': 'binary2.sh'}, |
| 1008 | } |
| 1009 | |
| 1010 | - y = meta._compose_package_yaml('meta', self.config_data, ['armhf', 'amd64']) |
| 1011 | + y = meta._compose_package_yaml('meta', self.config_data, |
| 1012 | + ['armhf', 'amd64']) |
| 1013 | |
| 1014 | self.assertEqual(len(y['binaries']), 2) |
| 1015 | for b in y['binaries']: |
| 1016 | @@ -92,7 +94,8 @@ |
| 1017 | }, |
| 1018 | } |
| 1019 | |
| 1020 | - y = meta._compose_package_yaml('meta', self.config_data, ['armhf', 'amd64']) |
| 1021 | + y = meta._compose_package_yaml('meta', self.config_data, |
| 1022 | + ['armhf', 'amd64']) |
| 1023 | |
| 1024 | self.assertEqual(len(y['services']), 2) |
| 1025 | for b in y['services']: |
| 1026 | @@ -105,7 +108,8 @@ |
| 1027 | def test_plain_no_binaries_or_services_with_optionals(self): |
| 1028 | self.config_data['frameworks'] = ['mir', ] |
| 1029 | |
| 1030 | - y = meta._compose_package_yaml('meta', self.config_data, ['armhf', 'amd64']) |
| 1031 | + y = meta._compose_package_yaml('meta', self.config_data, |
| 1032 | + ['armhf', 'amd64']) |
| 1033 | |
| 1034 | expected = { |
| 1035 | 'name': 'my-package', |
| 1036 | @@ -120,7 +124,8 @@ |
| 1037 | |
| 1038 | def test_compose_readme(self): |
| 1039 | self.config_data['summary'] = 'one line summary' |
| 1040 | - self.config_data['description'] = 'the description\nwhich can be longer' |
| 1041 | + self.config_data['description'] = \ |
| 1042 | + 'the description\nwhich can be longer' |
| 1043 | |
| 1044 | readme_text = '''one line summary |
| 1045 | the description |
| 1046 | @@ -170,7 +175,8 @@ |
| 1047 | } |
| 1048 | } |
| 1049 | |
| 1050 | - self.meta_dir = os.path.join(os.path.abspath(os.curdir), 'snap', 'meta') |
| 1051 | + self.meta_dir = os.path.join(os.path.abspath(os.curdir), |
| 1052 | + 'snap', 'meta') |
| 1053 | self.hooks_dir = os.path.join(self.meta_dir, 'hooks') |
| 1054 | |
| 1055 | self.expected_open_calls = [ |
| 1056 | @@ -263,7 +269,8 @@ |
| 1057 | mock_wrap_exe.assert_has_calls([ |
| 1058 | call( |
| 1059 | '$SNAP_APP_PATH/bin/bash', |
| 1060 | - os.path.join(os.path.abspath(os.curdir), 'snap/bin/bash.wrapper'), |
| 1061 | + os.path.join(os.path.abspath(os.curdir), |
| 1062 | + 'snap/bin/bash.wrapper'), |
| 1063 | ), |
| 1064 | call( |
| 1065 | 'bin/config', |
| 1066 | @@ -273,14 +280,18 @@ |
| 1067 | ), |
| 1068 | ]) |
| 1069 | self.mock_copyfile.assert_has_calls([ |
| 1070 | - call('my-icon.png', os.path.join(self.meta_dir, 'my-icon.png')), |
| 1071 | - call('file.apparmor', os.path.join(self.meta_dir, 'file.apparmor')), |
| 1072 | - call('file.seccomp', os.path.join(self.meta_dir, 'file.seccomp')), |
| 1073 | + call('my-icon.png', os.path.join(self.meta_dir, |
| 1074 | + 'my-icon.png')), |
| 1075 | + call('file.apparmor', os.path.join(self.meta_dir, |
| 1076 | + 'file.apparmor')), |
| 1077 | + call('file.seccomp', os.path.join(self.meta_dir, |
| 1078 | + 'file.seccomp')), |
| 1079 | ]) |
| 1080 | |
| 1081 | @patch('snapcraft.meta._write_wrap_exe') |
| 1082 | @patch('snapcraft.meta.open', create=True) |
| 1083 | - def test_create_meta_with_vararg_config(self, mock_the_open, mock_wrap_exe): |
| 1084 | + def test_create_meta_with_vararg_config(self, mock_the_open, |
| 1085 | + mock_wrap_exe): |
| 1086 | self.config_data['config'] = 'python3 my.py --config' |
| 1087 | |
| 1088 | meta.create(self.config_data, ['amd64']) |
| 1089 | @@ -294,7 +305,8 @@ |
| 1090 | mock_wrap_exe.assert_has_calls([ |
| 1091 | call( |
| 1092 | '$SNAP_APP_PATH/bin/bash', |
| 1093 | - os.path.join(os.path.abspath(os.curdir), 'snap/bin/bash.wrapper'), |
| 1094 | + os.path.join(os.path.abspath(os.curdir), |
| 1095 | + 'snap/bin/bash.wrapper'), |
| 1096 | ), |
| 1097 | call( |
| 1098 | 'python3', |
| 1099 | @@ -311,7 +323,8 @@ |
| 1100 | |
| 1101 | meta.create(self.config_data, ['amd64']) |
| 1102 | |
| 1103 | - self.mock_makedirs.assert_called_once_with(self.meta_dir, exist_ok=True) |
| 1104 | + self.mock_makedirs.assert_called_once_with(self.meta_dir, |
| 1105 | + exist_ok=True) |
| 1106 | mock_the_open.assert_has_calls(self.expected_open_calls) |
| 1107 | |
| 1108 | |
| 1109 | |
| 1110 | === modified file 'snapcraft/tests/test_plugin.py' |
| 1111 | --- snapcraft/tests/test_plugin.py 2015-09-22 03:51:37 +0000 |
| 1112 | +++ snapcraft/tests/test_plugin.py 2015-10-05 16:56:41 +0000 |
| 1113 | @@ -76,7 +76,8 @@ |
| 1114 | |
| 1115 | include, exclude = plugin._get_file_list(stage_set) |
| 1116 | |
| 1117 | - self.assertEqual(include, ['opt/something', 'usr/bin', '-everything', r'\a']) |
| 1118 | + self.assertEqual(include, ['opt/something', 'usr/bin', |
| 1119 | + '-everything', r'\a']) |
| 1120 | self.assertEqual(exclude, ['etc', 'usr/lib/*.a']) |
| 1121 | |
| 1122 | def test_fileset_only_includes(self): |
| 1123 | @@ -182,7 +183,8 @@ |
| 1124 | dstdir = tmpdir + '/stage' |
| 1125 | os.makedirs(dstdir) |
| 1126 | |
| 1127 | - snap_files, snap_dirs = plugin.migratable_filesets(filesets[key]['fileset'], srcdir) |
| 1128 | + snap_files, snap_dirs = plugin.migratable_filesets( |
| 1129 | + filesets[key]['fileset'], srcdir) |
| 1130 | plugin._migrate_files(snap_files, snap_dirs, srcdir, dstdir) |
| 1131 | |
| 1132 | expected = [] |
| 1133 | |
| 1134 | === modified file 'snapcraft/tests/test_repo.py' |
| 1135 | --- snapcraft/tests/test_repo.py 2015-09-23 14:24:04 +0000 |
| 1136 | +++ snapcraft/tests/test_repo.py 2015-10-05 16:56:41 +0000 |
| 1137 | @@ -31,7 +31,8 @@ |
| 1138 | sources_list = repo._format_sources_list( |
| 1139 | repo._DEFAULT_SOURCES, 'amd64', 'vivid') |
| 1140 | |
| 1141 | - expected_sources_list = '''deb http://ar.archive.ubuntu.com/ubuntu/ vivid main restricted |
| 1142 | + expected_sources_list = \ |
| 1143 | + '''deb http://ar.archive.ubuntu.com/ubuntu/ vivid main restricted |
| 1144 | deb http://ar.archive.ubuntu.com/ubuntu/ vivid-updates main restricted |
| 1145 | deb http://ar.archive.ubuntu.com/ubuntu/ vivid universe |
| 1146 | deb http://ar.archive.ubuntu.com/ubuntu/ vivid-updates universe |
| 1147 | @@ -48,7 +49,8 @@ |
| 1148 | sources_list = repo._format_sources_list( |
| 1149 | repo._DEFAULT_SOURCES, 'armhf', 'trusty') |
| 1150 | |
| 1151 | - expected_sources_list = '''deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted |
| 1152 | + expected_sources_list = \ |
| 1153 | + '''deb http://ports.ubuntu.com/ubuntu-ports/ trusty main restricted |
| 1154 | deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main restricted |
| 1155 | deb http://ports.ubuntu.com/ubuntu-ports/ trusty universe |
| 1156 | deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates universe |
| 1157 | |
| 1158 | === modified file 'snapcraft/tests/test_sources.py' |
| 1159 | --- snapcraft/tests/test_sources.py 2015-09-01 09:58:55 +0000 |
| 1160 | +++ snapcraft/tests/test_sources.py 2015-10-05 16:56:41 +0000 |
| 1161 | @@ -98,7 +98,8 @@ |
| 1162 | bzr.pull() |
| 1163 | |
| 1164 | self.mock_run.assert_called_once_with( |
| 1165 | - ['bzr', 'branch', '-r', 'tag:tag', 'lp:my-source', 'source_dir'], cwd=os.getcwd()) |
| 1166 | + ['bzr', 'branch', '-r', 'tag:tag', 'lp:my-source', |
| 1167 | + 'source_dir'], cwd=os.getcwd()) |
| 1168 | |
| 1169 | def test_pull_existing_with_tag(self): |
| 1170 | self.mock_path_exists.return_value = True |
| 1171 | @@ -107,7 +108,8 @@ |
| 1172 | bzr.pull() |
| 1173 | |
| 1174 | self.mock_run.assert_called_once_with( |
| 1175 | - ['bzr', 'pull', '-r', 'tag:tag', 'lp:my-source', '-d', 'source_dir'], cwd=os.getcwd()) |
| 1176 | + ['bzr', 'pull', '-r', 'tag:tag', 'lp:my-source', '-d', |
| 1177 | + 'source_dir'], cwd=os.getcwd()) |
| 1178 | |
| 1179 | def test_provision(self): |
| 1180 | bzr = sources.Bazaar('lp:my-source', 'source_dir') |
| 1181 | @@ -135,18 +137,21 @@ |
| 1182 | ['git', 'clone', 'git://my-source', 'source_dir'], cwd=os.getcwd()) |
| 1183 | |
| 1184 | def test_pull_branch(self): |
| 1185 | - git = sources.Git('git://my-source', 'source_dir', source_branch='my-branch') |
| 1186 | + git = sources.Git('git://my-source', 'source_dir', |
| 1187 | + source_branch='my-branch') |
| 1188 | git.pull() |
| 1189 | |
| 1190 | self.mock_run.assert_called_once_with( |
| 1191 | - ['git', 'clone', '--branch', 'my-branch', 'git://my-source', 'source_dir'], cwd=os.getcwd()) |
| 1192 | + ['git', 'clone', '--branch', 'my-branch', 'git://my-source', |
| 1193 | + 'source_dir'], cwd=os.getcwd()) |
| 1194 | |
| 1195 | def test_pull_tag(self): |
| 1196 | git = sources.Git('git://my-source', 'source_dir', source_tag='tag') |
| 1197 | git.pull() |
| 1198 | |
| 1199 | self.mock_run.assert_called_once_with( |
| 1200 | - ['git', 'clone', '--branch', 'tag', 'git://my-source', 'source_dir'], cwd=os.getcwd()) |
| 1201 | + ['git', 'clone', '--branch', 'tag', 'git://my-source', |
| 1202 | + 'source_dir'], cwd=os.getcwd()) |
| 1203 | |
| 1204 | def test_pull_existing(self): |
| 1205 | self.mock_path_exists.return_value = True |
| 1206 | @@ -155,7 +160,8 @@ |
| 1207 | git.pull() |
| 1208 | |
| 1209 | self.mock_run.assert_called_once_with( |
| 1210 | - ['git', '-C', 'source_dir', 'pull', 'git://my-source', 'HEAD'], cwd=os.getcwd()) |
| 1211 | + ['git', '-C', 'source_dir', 'pull', 'git://my-source', |
| 1212 | + 'HEAD'], cwd=os.getcwd()) |
| 1213 | |
| 1214 | def test_pull_existing_with_tag(self): |
| 1215 | self.mock_path_exists.return_value = True |
| 1216 | @@ -164,16 +170,19 @@ |
| 1217 | git.pull() |
| 1218 | |
| 1219 | self.mock_run.assert_called_once_with( |
| 1220 | - ['git', '-C', 'source_dir', 'pull', 'git://my-source', 'refs/tags/tag'], cwd=os.getcwd()) |
| 1221 | + ['git', '-C', 'source_dir', 'pull', 'git://my-source', |
| 1222 | + 'refs/tags/tag'], cwd=os.getcwd()) |
| 1223 | |
| 1224 | def test_pull_existing_with_branch(self): |
| 1225 | self.mock_path_exists.return_value = True |
| 1226 | |
| 1227 | - git = sources.Git('git://my-source', 'source_dir', source_branch='my-branch') |
| 1228 | + git = sources.Git('git://my-source', 'source_dir', |
| 1229 | + source_branch='my-branch') |
| 1230 | git.pull() |
| 1231 | |
| 1232 | self.mock_run.assert_called_once_with( |
| 1233 | - ['git', '-C', 'source_dir', 'pull', 'git://my-source', 'refs/heads/my-branch'], cwd=os.getcwd()) |
| 1234 | + ['git', '-C', 'source_dir', 'pull', 'git://my-source', |
| 1235 | + 'refs/heads/my-branch'], cwd=os.getcwd()) |
| 1236 | |
| 1237 | def test_provision(self): |
| 1238 | bzr = sources.Git('git://my-source', 'source_dir') |
| 1239 | @@ -184,9 +193,11 @@ |
| 1240 | |
| 1241 | def test_init_with_source_branch_and_tag_raises_exception(self): |
| 1242 | with self.assertRaises(sources.IncompatibleOptionsError) as raised: |
| 1243 | - sources.Git('git://mysource', 'source_dir', source_tag='tag', source_branch='branch') |
| 1244 | + sources.Git('git://mysource', 'source_dir', source_tag='tag', |
| 1245 | + source_branch='branch') |
| 1246 | |
| 1247 | - expected_message = 'can\'t specify both source-tag and source-branch for a git source' |
| 1248 | + expected_message = \ |
| 1249 | + 'can\'t specify both source-tag and source-branch for a git source' |
| 1250 | self.assertEqual(raised.exception.message, expected_message) |
| 1251 | |
| 1252 | |
| 1253 | @@ -200,18 +211,22 @@ |
| 1254 | ['hg', 'clone', 'hg://my-source', 'source_dir'], cwd=os.getcwd()) |
| 1255 | |
| 1256 | def test_pull_branch(self): |
| 1257 | - hg = sources.Mercurial('hg://my-source', 'source_dir', source_branch='my-branch') |
| 1258 | + hg = sources.Mercurial('hg://my-source', 'source_dir', |
| 1259 | + source_branch='my-branch') |
| 1260 | hg.pull() |
| 1261 | |
| 1262 | self.mock_run.assert_called_once_with( |
| 1263 | - ['hg', 'clone', '-u', 'my-branch', 'hg://my-source', 'source_dir'], cwd=os.getcwd()) |
| 1264 | + ['hg', 'clone', '-u', 'my-branch', 'hg://my-source', |
| 1265 | + 'source_dir'], cwd=os.getcwd()) |
| 1266 | |
| 1267 | def test_pull_tag(self): |
| 1268 | - hg = sources.Mercurial('hg://my-source', 'source_dir', source_tag='tag') |
| 1269 | + hg = sources.Mercurial('hg://my-source', 'source_dir', |
| 1270 | + source_tag='tag') |
| 1271 | hg.pull() |
| 1272 | |
| 1273 | self.mock_run.assert_called_once_with( |
| 1274 | - ['hg', 'clone', '-u', 'tag', 'hg://my-source', 'source_dir'], cwd=os.getcwd()) |
| 1275 | + ['hg', 'clone', '-u', 'tag', 'hg://my-source', |
| 1276 | + 'source_dir'], cwd=os.getcwd()) |
| 1277 | |
| 1278 | def test_pull_existing(self): |
| 1279 | self.mock_path_exists.return_value = True |
| 1280 | @@ -225,7 +240,8 @@ |
| 1281 | def test_pull_existing_with_tag(self): |
| 1282 | self.mock_path_exists.return_value = True |
| 1283 | |
| 1284 | - hg = sources.Mercurial('hg://my-source', 'source_dir', source_tag='tag') |
| 1285 | + hg = sources.Mercurial('hg://my-source', 'source_dir', |
| 1286 | + source_tag='tag') |
| 1287 | hg.pull() |
| 1288 | |
| 1289 | self.mock_run.assert_called_once_with( |
| 1290 | @@ -234,11 +250,13 @@ |
| 1291 | def test_pull_existing_with_branch(self): |
| 1292 | self.mock_path_exists.return_value = True |
| 1293 | |
| 1294 | - hg = sources.Mercurial('hg://my-source', 'source_dir', source_branch='my-branch') |
| 1295 | + hg = sources.Mercurial('hg://my-source', 'source_dir', |
| 1296 | + source_branch='my-branch') |
| 1297 | hg.pull() |
| 1298 | |
| 1299 | self.mock_run.assert_called_once_with( |
| 1300 | - ['hg', 'pull', '-b', 'my-branch', 'hg://my-source'], cwd=os.getcwd()) |
| 1301 | + ['hg', 'pull', '-b', 'my-branch', 'hg://my-source'], |
| 1302 | + cwd=os.getcwd()) |
| 1303 | |
| 1304 | def test_provision(self): |
| 1305 | bzr = sources.Mercurial('hg://my-source', 'source_dir') |
| 1306 | @@ -249,9 +267,11 @@ |
| 1307 | |
| 1308 | def test_init_with_source_branch_and_tag_raises_exception(self): |
| 1309 | with self.assertRaises(sources.IncompatibleOptionsError) as raised: |
| 1310 | - sources.Mercurial('hg://mysource', 'source_dir', source_tag='tag', source_branch='branch') |
| 1311 | + sources.Mercurial('hg://mysource', 'source_dir', source_tag='tag', |
| 1312 | + source_branch='branch') |
| 1313 | |
| 1314 | - expected_message = 'can\'t specify both source-tag and source-branch for a mercurial source' |
| 1315 | + expected_message = 'can\'t specify both source-tag and source-branch ' |
| 1316 | + 'for a mercurial source' |
| 1317 | self.assertEqual(raised.exception.message, expected_message) |
| 1318 | |
| 1319 | |
| 1320 | @@ -288,7 +308,8 @@ |
| 1321 | local.provision('dst') |
| 1322 | |
| 1323 | self.mock_rmdir.assert_called_once_with('dst') |
| 1324 | - self.mock_symlink.assert_called_once_with('/home/ubuntu/sources/snap/source', 'dst') |
| 1325 | + self.mock_symlink.assert_called_once_with( |
| 1326 | + '/home/ubuntu/sources/snap/source', 'dst') |
| 1327 | |
| 1328 | def test_provision_when_target_is_file(self): |
| 1329 | self.mock_isdir.return_value = False |
| 1330 | @@ -297,4 +318,5 @@ |
| 1331 | local.provision('dst') |
| 1332 | |
| 1333 | self.mock_remove.assert_called_once_with('dst') |
| 1334 | - self.mock_symlink.assert_called_once_with('/home/ubuntu/sources/snap/source', 'dst') |
| 1335 | + self.mock_symlink.assert_called_once_with( |
| 1336 | + '/home/ubuntu/sources/snap/source', 'dst') |
| 1337 | |
| 1338 | === modified file 'snapcraft/tests/test_yaml.py' |
| 1339 | --- snapcraft/tests/test_yaml.py 2015-10-01 08:54:15 +0000 |
| 1340 | +++ snapcraft/tests/test_yaml.py 2015-10-05 16:56:41 +0000 |
| 1341 | @@ -101,7 +101,8 @@ |
| 1342 | self.useFixture(fake_logger) |
| 1343 | |
| 1344 | # no snapcraft.yaml |
| 1345 | - with self.assertRaises(snapcraft.yaml.SnapcraftYamlFileError) as raised: |
| 1346 | + with self.assertRaises( |
| 1347 | + snapcraft.yaml.SnapcraftYamlFileError) as raised: |
| 1348 | snapcraft.yaml.Config() |
| 1349 | |
| 1350 | self.assertEqual(raised.exception.file, 'snapcraft.yaml') |
| 1351 | @@ -130,7 +131,9 @@ |
| 1352 | with self.assertRaises(snapcraft.yaml.SnapcraftLogicError) as raised: |
| 1353 | snapcraft.yaml.Config() |
| 1354 | |
| 1355 | - self.assertEqual(raised.exception.message, 'circular dependency chain found in parts definition') |
| 1356 | + self.assertEqual( |
| 1357 | + raised.exception.message, |
| 1358 | + 'circular dependency chain found in parts definition') |
| 1359 | self.assertFalse(self.mock_wiki.get_part.called) |
| 1360 | |
| 1361 | @unittest.mock.patch('snapcraft.yaml.Config.load_plugin') |
| 1362 | @@ -153,7 +156,8 @@ |
| 1363 | with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1364 | snapcraft.yaml.Config() |
| 1365 | |
| 1366 | - self.assertEqual(raised.exception.message, '\'name\' is a required property') |
| 1367 | + self.assertEqual(raised.exception.message, |
| 1368 | + '\'name\' is a required property') |
| 1369 | |
| 1370 | @unittest.mock.patch('snapcraft.yaml.Config.load_plugin') |
| 1371 | def test_invalid_yaml_invalid_name_as_number(self, mock_loadPlugin): |
| 1372 | @@ -175,7 +179,8 @@ |
| 1373 | with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1374 | snapcraft.yaml.Config() |
| 1375 | |
| 1376 | - self.assertEqual(raised.exception.message, '1 is not of type \'string\'') |
| 1377 | + self.assertEqual(raised.exception.message, |
| 1378 | + '1 is not of type \'string\'') |
| 1379 | |
| 1380 | @unittest.mock.patch('snapcraft.yaml.Config.load_plugin') |
| 1381 | def test_invalid_yaml_invalid_name_chars(self, mock_loadPlugin): |
| 1382 | @@ -197,7 +202,9 @@ |
| 1383 | with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1384 | snapcraft.yaml.Config() |
| 1385 | |
| 1386 | - self.assertEqual(raised.exception.message, '\'myapp@me_1.0\' does not match \'^[a-z0-9][a-z0-9+-]*$\'') |
| 1387 | + self.assertEqual( |
| 1388 | + raised.exception.message, |
| 1389 | + '\'myapp@me_1.0\' does not match \'^[a-z0-9][a-z0-9+-]*$\'') |
| 1390 | |
| 1391 | @unittest.mock.patch('snapcraft.yaml.Config.load_plugin') |
| 1392 | def test_deprecation_for_type(self, mock_loadPlugin): |
| 1393 | @@ -240,7 +247,9 @@ |
| 1394 | with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1395 | snapcraft.yaml.Config() |
| 1396 | |
| 1397 | - self.assertEqual(raised.exception.message, '\'description\' is a required property') |
| 1398 | + self.assertEqual( |
| 1399 | + raised.exception.message, |
| 1400 | + '\'description\' is a required property') |
| 1401 | |
| 1402 | @unittest.mock.patch('snapcraft.yaml.Config.load_plugin') |
| 1403 | def test_tab_in_yaml(self, mock_loadPlugin): |
| 1404 | @@ -296,7 +305,8 @@ |
| 1405 | snapcraft.yaml.Config() |
| 1406 | |
| 1407 | mock_loadPlugin.assert_called_with('part1', 'go', { |
| 1408 | - 'snap': ['/usr/lib/wget.so', '/usr/bin/wget', '/usr/share/my-icon.png'], |
| 1409 | + 'snap': ['/usr/lib/wget.so', '/usr/bin/wget', |
| 1410 | + '/usr/share/my-icon.png'], |
| 1411 | 'stage-packages': ['fswebcam'], |
| 1412 | 'stage': ['/usr/lib/wget.so', '/usr/bin/wget', '/usr/lib/wget.a'], |
| 1413 | }) |
| 1414 | @@ -333,11 +343,13 @@ |
| 1415 | with self.subTest(key=key): |
| 1416 | del data[key] |
| 1417 | |
| 1418 | - with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1419 | + with self.assertRaises( |
| 1420 | + snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1421 | snapcraft.yaml._validate_snapcraft_yaml(data) |
| 1422 | |
| 1423 | expected_message = '\'{}\' is a required property'.format(key) |
| 1424 | - self.assertEqual(raised.exception.message, expected_message, msg=data) |
| 1425 | + self.assertEqual(raised.exception.message, expected_message, |
| 1426 | + msg=data) |
| 1427 | |
| 1428 | def test_invalid_names(self): |
| 1429 | invalid_names = [ |
| 1430 | @@ -351,11 +363,14 @@ |
| 1431 | with self.subTest(key=name): |
| 1432 | data['name'] = name |
| 1433 | |
| 1434 | - with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1435 | + with self.assertRaises( |
| 1436 | + snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1437 | snapcraft.yaml._validate_snapcraft_yaml(data) |
| 1438 | |
| 1439 | - expected_message = '\'{}\' does not match \'^[a-z0-9][a-z0-9+-]*$\''.format(name) |
| 1440 | - self.assertEqual(raised.exception.message, expected_message, msg=data) |
| 1441 | + expected_message = '\'{}\' does not match ' |
| 1442 | + '\'^[a-z0-9][a-z0-9+-]*$\''.format(name) |
| 1443 | + self.assertEqual(raised.exception.message, expected_message, |
| 1444 | + msg=data) |
| 1445 | |
| 1446 | def test_summary_too_long(self): |
| 1447 | self.data['summary'] = 'a' * 80 |
| 1448 | @@ -363,7 +378,8 @@ |
| 1449 | snapcraft.yaml._validate_snapcraft_yaml(self.data) |
| 1450 | |
| 1451 | expected_message = '\'{}\' is too long'.format(self.data['summary']) |
| 1452 | - self.assertEqual(raised.exception.message, expected_message, msg=self.data) |
| 1453 | + self.assertEqual(raised.exception.message, expected_message, |
| 1454 | + msg=self.data) |
| 1455 | |
| 1456 | def test_valid_types(self): |
| 1457 | self.data['type'] = 'app' |
| 1458 | @@ -386,11 +402,14 @@ |
| 1459 | with self.subTest(key=t): |
| 1460 | data['type'] = t |
| 1461 | |
| 1462 | - with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1463 | + with self.assertRaises( |
| 1464 | + snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1465 | snapcraft.yaml._validate_snapcraft_yaml(data) |
| 1466 | |
| 1467 | - expected_message = '\'{}\' is not one of [\'app\', \'framework\']'.format(t) |
| 1468 | - self.assertEqual(raised.exception.message, expected_message, msg=data) |
| 1469 | + expected_message = ('\'{}\' is not one of ' + |
| 1470 | + '[\'app\', \'framework\']').format(t) |
| 1471 | + self.assertEqual(raised.exception.message, expected_message, |
| 1472 | + msg=data) |
| 1473 | |
| 1474 | def test_valid_services(self): |
| 1475 | self.data['services'] = { |
| 1476 | @@ -416,11 +435,14 @@ |
| 1477 | with self.subTest(key=t): |
| 1478 | data['binaries'] = {t: invalid_names[t]} |
| 1479 | |
| 1480 | - with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1481 | + with self.assertRaises( |
| 1482 | + snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1483 | snapcraft.yaml._validate_snapcraft_yaml(data) |
| 1484 | |
| 1485 | - expected_message = 'Additional properties are not allowed (\'{}\' was unexpected)'.format(t) |
| 1486 | - self.assertEqual(raised.exception.message, expected_message, msg=data) |
| 1487 | + expected_message = ('Additional properties are not allowed ' |
| 1488 | + '(\'{}\' was unexpected)').format(t) |
| 1489 | + self.assertEqual(raised.exception.message, expected_message, |
| 1490 | + msg=data) |
| 1491 | |
| 1492 | def test_invalid_service_names(self): |
| 1493 | invalid_names = { |
| 1494 | @@ -435,11 +457,14 @@ |
| 1495 | with self.subTest(key=t): |
| 1496 | data['services'] = {t: invalid_names[t]} |
| 1497 | |
| 1498 | - with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1499 | + with self.assertRaises( |
| 1500 | + snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1501 | snapcraft.yaml._validate_snapcraft_yaml(data) |
| 1502 | |
| 1503 | - expected_message = 'Additional properties are not allowed (\'{}\' was unexpected)'.format(t) |
| 1504 | - self.assertEqual(raised.exception.message, expected_message, msg=data) |
| 1505 | + expected_message = ('Additional properties are not allowed ' |
| 1506 | + '(\'{}\' was unexpected)').format(t) |
| 1507 | + self.assertEqual(raised.exception.message, expected_message, |
| 1508 | + msg=data) |
| 1509 | |
| 1510 | def test_services_required_properties(self): |
| 1511 | self.data['services'] = {'service1': {}} |
| 1512 | @@ -448,19 +473,24 @@ |
| 1513 | snapcraft.yaml._validate_snapcraft_yaml(self.data) |
| 1514 | |
| 1515 | expected_message = '\'start\' is a required property' |
| 1516 | - self.assertEqual(raised.exception.message, expected_message, msg=self.data) |
| 1517 | + self.assertEqual(raised.exception.message, expected_message, |
| 1518 | + msg=self.data) |
| 1519 | |
| 1520 | def test_schema_file_not_found(self): |
| 1521 | mock_the_open = unittest.mock.mock_open() |
| 1522 | mock_the_open.side_effect = FileNotFoundError() |
| 1523 | |
| 1524 | - with unittest.mock.patch('snapcraft.yaml.open', mock_the_open, create=True): |
| 1525 | - with self.assertRaises(snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1526 | + with unittest.mock.patch('snapcraft.yaml.open', mock_the_open, |
| 1527 | + create=True): |
| 1528 | + with self.assertRaises( |
| 1529 | + snapcraft.yaml.SnapcraftSchemaError) as raised: |
| 1530 | snapcraft.yaml._validate_snapcraft_yaml(self.data) |
| 1531 | |
| 1532 | - expected_path = os.path.join(snapcraft.common.get_schemadir(), 'snapcraft.yaml') |
| 1533 | + expected_path = os.path.join(snapcraft.common.get_schemadir(), |
| 1534 | + 'snapcraft.yaml') |
| 1535 | mock_the_open.assert_called_once_with(expected_path) |
| 1536 | - expected_message = 'snapcraft validation file is missing from installation path' |
| 1537 | + expected_message = ('snapcraft validation file is missing from ' |
| 1538 | + 'installation path') |
| 1539 | self.assertEqual(raised.exception.message, expected_message) |
| 1540 | |
| 1541 | def test_icon_missing(self): |
| 1542 | @@ -470,7 +500,8 @@ |
| 1543 | snapcraft.yaml._validate_snapcraft_yaml(self.data) |
| 1544 | |
| 1545 | expected_message = '\'my-icon.png\' is not a \'icon-path\'' |
| 1546 | - self.assertEqual(raised.exception.message, expected_message, msg=self.data) |
| 1547 | + self.assertEqual(raised.exception.message, expected_message, |
| 1548 | + msg=self.data) |
| 1549 | |
| 1550 | |
| 1551 | class TestFilesets(TestCase): |
| 1552 | |
| 1553 | === modified file 'snapcraft/yaml.py' |
| 1554 | --- snapcraft/yaml.py 2015-10-02 18:25:33 +0000 |
| 1555 | +++ snapcraft/yaml.py 2015-10-05 16:56:41 +0000 |
| 1556 | @@ -145,14 +145,16 @@ |
| 1557 | present = True |
| 1558 | break |
| 1559 | if not present: |
| 1560 | - new_parts.append(self.load_plugin(required_part, required_part, {})) |
| 1561 | + new_parts.append(self.load_plugin(required_part, |
| 1562 | + required_part, {})) |
| 1563 | |
| 1564 | def _compute_part_dependencies(self, after_requests): |
| 1565 | '''Gather the lists of dependencies and adds to all_parts.''' |
| 1566 | w = snapcraft.wiki.Wiki() |
| 1567 | |
| 1568 | for part in self.all_parts: |
| 1569 | - dep_names = part.config.get('requires', []) + after_requests.get(part.names()[0], []) |
| 1570 | + dep_names = part.config.get('requires', []) + \ |
| 1571 | + after_requests.get(part.names()[0], []) |
| 1572 | for dep in dep_names: |
| 1573 | found = False |
| 1574 | for i in range(len(self.all_parts)): |
| 1575 | @@ -164,9 +166,11 @@ |
| 1576 | wiki_part = w.get_part(dep) |
| 1577 | found = True if wiki_part else False |
| 1578 | if found: |
| 1579 | - part.deps.append(self.load_plugin(dep, wiki_part['plugin'], wiki_part)) |
| 1580 | + part.deps.append(self.load_plugin( |
| 1581 | + dep, wiki_part['plugin'], wiki_part)) |
| 1582 | if not found: |
| 1583 | - raise SnapcraftLogicError('part name missing {}'.format(dep)) |
| 1584 | + raise SnapcraftLogicError( |
| 1585 | + 'part name missing {}'.format(dep)) |
| 1586 | |
| 1587 | def _sort_parts(self): |
| 1588 | '''Performs an inneficient but easy to follow sorting of parts.''' |
| 1589 | @@ -184,14 +188,16 @@ |
| 1590 | top_part = part |
| 1591 | break |
| 1592 | if not top_part: |
| 1593 | - raise SnapcraftLogicError('circular dependency chain found in parts definition') |
| 1594 | + raise SnapcraftLogicError( |
| 1595 | + 'circular dependency chain found in parts definition') |
| 1596 | sorted_parts = [top_part] + sorted_parts |
| 1597 | self.all_parts.remove(top_part) |
| 1598 | |
| 1599 | return sorted_parts |
| 1600 | |
| 1601 | def load_plugin(self, part_name, plugin_name, properties, load_code=True): |
| 1602 | - part = snapcraft.plugin.load_plugin(part_name, plugin_name, properties, load_code=load_code) |
| 1603 | + part = snapcraft.plugin.load_plugin(part_name, plugin_name, |
| 1604 | + properties, load_code=load_code) |
| 1605 | |
| 1606 | self.build_tools += part.config.get('build-packages', []) |
| 1607 | self.all_parts.append(part) |
| 1608 | @@ -280,15 +286,18 @@ |
| 1609 | |
| 1610 | |
| 1611 | def _validate_snapcraft_yaml(snapcraft_yaml): |
| 1612 | - schema_file = os.path.abspath(os.path.join(common.get_schemadir(), 'snapcraft.yaml')) |
| 1613 | + schema_file = os.path.abspath(os.path.join(common.get_schemadir(), |
| 1614 | + 'snapcraft.yaml')) |
| 1615 | |
| 1616 | try: |
| 1617 | with open(schema_file) as fp: |
| 1618 | schema = yaml.load(fp) |
| 1619 | format_check = jsonschema.FormatChecker() |
| 1620 | - jsonschema.validate(snapcraft_yaml, schema, format_checker=format_check) |
| 1621 | + jsonschema.validate(snapcraft_yaml, schema, |
| 1622 | + format_checker=format_check) |
| 1623 | except FileNotFoundError: |
| 1624 | - raise SnapcraftSchemaError('snapcraft validation file is missing from installation path') |
| 1625 | + raise SnapcraftSchemaError( |
| 1626 | + 'snapcraft validation file is missing from installation path') |
| 1627 | except jsonschema.ValidationError as e: |
| 1628 | raise SnapcraftSchemaError(e.message) |
| 1629 |


If we are going to do this, maybe also remove the pep8 exception