Skip to content
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

@veqtrus
Copy link
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
Copy link
Contributor

jgarzik commented Jul 3, 2015

seems reasonable

@laanwj
Copy link
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
Copy link
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
laanwj reviewed Jul 3, 2015
View changes
contrib/linearize/linearize-data.py Outdated
@@ -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.

Copy link
@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
Copy link
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
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
e3c4297 Update Linearize tool to support Windows paths (Paul Georgiou)
@veqtrus veqtrus deleted the veqtrus:linearize_win branch Jul 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.