Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
bpo-31904 : Add support for VxWorks RTOS#4184
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
10d44059d53ef2db2e0e8cb3aa971939a139a92b63e997ecc7faa28198d3bdf249794c8bab32521457f7b6c9012809b73a847515f4abb38d08d4b40c8c322cfd303e093dca1b288e627c768168e7bf7e3f4b41a9f94b66a2b16c82215bc2e6921cf8e62ed3608616354d9158ac6d7110760da7a1a0786f9752833aeb5a6ddd24c10e83c1d8f1e3e7229c94e64a59407cf0fdd7233711da290567aa2e09f18463dddb70b18dd55e390ad214f7058513a6e829f9a9e4c6ec4c0651a3e1464ec2302fdda86bb73d9a5e660837e4b940f1e9e98c0d014f4228058d7fdefac9561d7fa582432f5f8a74209108b57750be86fdad0f3da70f70e30427f386374d6543078758f271a0b0e5d2dcd07876778e985afc709f6ad29fd9ea9ea42d2c7de1d72b5937ea23d30ff33eced52f7458e86db34133514e1a0239ee6499a05c5e61b5b933aa4abcbc0fea0a122bb0bfa9197e5d2c6f6684e7a964a702f6ba747cf6e1f0fd99dad132ad3997cfbe4165ac8e48373aaf36105fcbf0e361733a047a77df8049b82e97b2ef69a1e39429ae603320170b3f7a0b998dfe61e8d40f7d9a09df4b7ba4f218972edd97041c7685f315b83b8cd8044259938b4dd774ebbae65c32bb09819ef53374cc9b5a90bef20abee81a6c82e8d900deab1938e29fd48caee0f7bc49fbf0616ce960dec6f26b019af6eaae7b76b99803e1a555889903db05a30f76411025544aafb5e55aeb5d73d5be8e1fa9a5027da582d38928990442de52e84e47ca82e3c034a94519b7f662072c800cd3581622a824a3d6c1bbab4fe31d927d4eed3c7a98a86cb7452f6de5d38de69607b4c59bc98bc2e110dfa114401dd52fe5a9b35b4c6bdc21fb278640cce7f64606e8f2516ad16ad7fbf0607a785ced6084256d7d62768dd7460b61490c04ca9f18809265722701dd768c61936b06340ba5ab7dc42724c79857fcdaa817217b2d961a4f2792465c70461bda72b343df5697838598648875bb82addd1a037b7dc8a74b6d6fc9529fcc3d30bdf4b6ff39e4d4ef2682d6ddde264d0c89e469ff954d5127acd0ecc4043aeefc0b620c479f497acbcfdf9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -753,7 +753,7 @@ def _syscmd_uname(option, default=''): | ||
| return default | ||
| try: | ||
| f = os.popen('uname %s 2> %s' % (option, DEV_NULL)) | ||
| except (AttributeError, OSError): | ||
| except (AttributeError, OSError, ValueError): | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks suspicious. Does os.popen() now return different exceptions? I suspect you should fix os.popen() to trap ValueError and return OSError instead. Otherwise everyone who uses os.popen() has to deal with the new exception case. | ||
| return default | ||
| output = f.read().strip() | ||
| rc = f.close() | ||
| @@ -771,7 +771,7 @@ def _syscmd_file(target, default=''): | ||
| default in case the command should fail. | ||
| """ | ||
| if sys.platform in ('dos', 'win32', 'win16'): | ||
| if sys.platform in ('dos', 'win32', 'win16', 'vxworks'): | ||
| # XXX Others too ? | ||
| return default | ||
| target = _follow_symlinks(target) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -28,6 +28,10 @@ | ||
| import genericpath | ||
| from genericpath import * | ||
| _vxworks = 'vxworks' in sys.platform | ||
| if _vxworks: | ||
| import _vxwapi | ||
| __all__ = ["normcase","isabs","join","splitdrive","split","splitext", | ||
| "basename","dirname","commonprefix","getsize","getmtime", | ||
| "getatime","getctime","islink","exists","lexists","isdir","isfile", | ||
| @@ -65,13 +69,17 @@ def isabs(s): | ||
| """Test whether a path is absolute""" | ||
| s = os.fspath(s) | ||
| sep = _get_sep(s) | ||
| if _vxworks: #VxWorks paths dont always start with / and there is no good | ||
| # way to find if a path is absolute. V7COR-3074, F7233 | ||
| if not isinstance(s, str): | ||
| s = s.decode(sys.getdefaultencoding()) | ||
| return bool(_vxwapi.isAbs(s)) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, you are doing the _vxworks test on every function call for every platform. Not a huge deal but isabs() might be called a lot. Instead, define a new isabs() on vxworks. | ||
| return s.startswith(sep) | ||
| # Join pathnames. | ||
| # Ignore the previous parts if a part is absolute. | ||
| # Insert a '/' unless the first part is empty or already ends in '/'. | ||
| def join(a, *p): | ||
| """Join two or more pathname components, inserting '/' as needed. | ||
| If any component is an absolute path, all previous path components | ||
| @@ -401,8 +409,18 @@ def _joinrealpath(path, rest, seen): | ||
| pardir = '..' | ||
| if isabs(rest): | ||
| rest = rest[1:] | ||
| path = sep | ||
| if not _vxworks: | ||
| rest = rest[1:] | ||
| path = sep | ||
| else: | ||
| if rest.startswith(sep): | ||
| rest = rest[1:] | ||
| path = sep | ||
| else: | ||
| ind = rest.find(':') | ||
| ind = 0 if ind < 0 else ind | ||
| path = rest[:ind] | ||
| rest = rest[ind:] | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, runtime testing of _vxworks. Better to define a special _joinrealpath() function at module import time. | ||
| while rest: | ||
| name, _, rest = rest.partition(sep) | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
This is not good. First, 'try' is bare 'except' is bad news, hides bugs. Second, you are doing the 'vxworks' test on every function call, for every platform. Instead you could have something like: