New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Linearize tool to support Windows paths; fix variable scope; update README and example configuration #6372

Merged
merged 1 commit into from Jul 17, 2015

Conversation

Projects
None yet
4 participants
@veqtrus
Contributor

veqtrus commented Jul 3, 2015

Windows uses backslashes () in paths. An option has been added to allow setting which type of slash to be used. By default the forward slash (/) is used. Also updated the example configuration with the respective option.

I added 'self.' in front of a few variables since without it the script didn't work for me.

Minor fixes for README.

@jgarzik

This comment has been minimized.

Show comment
Hide comment
@jgarzik

jgarzik Jul 3, 2015

Contributor

seems reasonable

Contributor

jgarzik commented Jul 3, 2015

seems reasonable

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Jul 3, 2015

Member

Python has excellent path manipulation utilities. Instead of making the path character configurable, why not use Python's path.join?

Member

laanwj commented Jul 3, 2015

Python has excellent path manipulation utilities. Instead of making the path character configurable, why not use Python's path.join?

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Jul 3, 2015

Member

slightly tested ACK (not on windows).
Would recommend to squash to purge out the reverts and the non-path.join way.

Member

jonasschnelli commented Jul 3, 2015

slightly tested ACK (not on windows).
Would recommend to squash to purge out the reverts and the non-path.join way.

@laanwj

View changes

Show outdated Hide outdated contrib/linearize/linearize-data.py
@@ -209,14 +210,14 @@ def run(self):
return
inLenLE = inhdr[4:]
su = struct.unpack("<I", inLenLE)
inLen = su[0] - 80 # length without header
self.inLen = su[0] - 80 # length without header

This comment has been minimized.

@laanwj

laanwj Jul 3, 2015

Member

I'm not sure making inLen an instance variable is the right solution to the problem.
Only one function outside run(), writeBlock(), uses self.inLen, which is never defined, but the on-disk size can be easily computed in the function itself with:

def writeBlock(self, inhdr, blk_hdr, rawblock):
    blockSizeOnDisk = len(inhdr) + len(blk_hdr) + len(rawblock)
    if not self.fileOutput and ((self.outsz + blockSizeOnDisk) > self.maxOutSz):
@laanwj

laanwj Jul 3, 2015

Member

I'm not sure making inLen an instance variable is the right solution to the problem.
Only one function outside run(), writeBlock(), uses self.inLen, which is never defined, but the on-disk size can be easily computed in the function itself with:

def writeBlock(self, inhdr, blk_hdr, rawblock):
    blockSizeOnDisk = len(inhdr) + len(blk_hdr) + len(rawblock)
    if not self.fileOutput and ((self.outsz + blockSizeOnDisk) > self.maxOutSz):
@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Jul 10, 2015

Member

ACK after squashing commits into one

Member

laanwj commented Jul 10, 2015

ACK after squashing commits into one

@veqtrus veqtrus closed this Jul 10, 2015

@veqtrus veqtrus reopened this Jul 10, 2015

@laanwj laanwj merged commit e3c4297 into bitcoin:master Jul 17, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Jul 17, 2015

Merge pull request #6372
e3c4297 Update Linearize tool to support Windows paths (Paul Georgiou)

@veqtrus veqtrus deleted the veqtrus:linearize_win branch Jul 26, 2015

@str4d str4d referenced this pull request Feb 15, 2017

Merged

Bitcoin 0.12 misc PRs 1 #2099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment