-
Notifications
You must be signed in to change notification settings - Fork 29
Update geoid.py #1
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
base: master
Are you sure you want to change the base?
Conversation
added windows support
vandry
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the mmap documentation says you can use the form with access= as a keyword argument for all operating systems. I tested; it works. So you don't need an if statement at all. See https://docs.python.org/2/library/mmap.html
| self.raw = mmap.mmap(fd, fullsize, mmap.MAP_SHARED, mmap.PROT_READ) | ||
|
|
||
| if (os.name == "posix"): | ||
| #Linux-Version: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is nothing Linux specific about this. It'll work on, say, Solaris or BSD as well.
Actually, you want probably just do without this comment altogether. It's clear what the "if" is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. You can throw the comments away
| self.headerlen = headerlen | ||
| self.raw = mmap.mmap(fd, fullsize, mmap.MAP_SHARED, mmap.PROT_READ) | ||
|
|
||
| if (os.name == "posix"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nit: don't use parentheses here.
| self.raw = mmap.mmap(fd, fullsize, mmap.MAP_SHARED, mmap.PROT_READ) | ||
| else: | ||
| #Windows-Version: | ||
| self.raw = mmap.mmap(fd, fullsize, access=mmap.ACCESS_READ)#mmap.MAP_SHARED, mmap.PROT_READ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please get rid of the commented text at the end of the line.
|
I've just tested it under windows. The parameter access=ACCESS_READ is important to not throw an error. If you sucessfully tested it under posix- system, then it's fine. Then it will be just one line intead of three. |
added windows support