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 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
Contributor

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

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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 linearize_win branch July 26, 2015 09:35
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants