Skip to content

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

Closed
wants to merge 221 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
221 commits
Select commit Hold shift + click to select a range
10d4405
patch configure for VxWorks
kuhlenough Sep 15, 2017
9d53ef2
Any version of python should be OK for cross build.
kuhlenough Sep 15, 2017
db2e0e8
undef DATE TIME for VxWorks
kuhlenough Sep 17, 2017
cb3aa97
limited signal feilds in VxWorks
kuhlenough Sep 17, 2017
1939a13
bpo-31904 : Python should support VxWorks RTOS
kuhlenough Sep 15, 2017
9a92b63
What's new file for bpo-30914
kuhlenough Oct 31, 2017
e997ecc
**install** and **commoninstall** targets do not include shared libra…
kuhlenough Oct 31, 2017
7faa281
revert Makefile.pre.in static build changes
kuhlenough Nov 1, 2017
98d3bdf
Merge branch 'master' of https://github.com/kuhlenough/cpython
kuhlenough Nov 1, 2017
249794c
EOL whitespace removal
kuhlenough Nov 1, 2017
8bab325
Remove space
kuhlenough Nov 3, 2017
21457f7
revert change
kuhlenough Nov 3, 2017
b6c9012
Merge branch 'master' of https://github.com/kuhlenough/cpython
kuhlenough Nov 9, 2017
809b73a
whitespace
kuhlenough Nov 9, 2017
847515f
Merge remote-tracking branch 'upstream/master'
kuhlenough Nov 9, 2017
4abb38d
pull review changes
kuhlenough Nov 9, 2017
08d4b40
Merge branch 'master' of https://github.com/kuhlenough/cpython
kuhlenough Nov 9, 2017
c8c322c
VxWorks has no h_errno reworked
kuhlenough Nov 9, 2017
fd303e0
Ignor readelf cross-compile error with VxWorks
kuhlenough Nov 9, 2017
93dca1b
ssl detections differences with varibles
kuhlenough Nov 9, 2017
288e627
fix indent with patchcheck
kuhlenough Nov 9, 2017
c768168
add VxWorks support for os_cpu_count, spawnv, spawnve
kuhlenough Nov 10, 2017
e7bf7e3
Merge branch 'master' of https://github.com/kuhlenough/cpython
kuhlenough Nov 10, 2017
f4b41a9
Don't build or install shared libraries if
kuhlenough Nov 18, 2017
f94b66a
Merge remote-tracking branch 'upstream/master'
kuhlenough Nov 18, 2017
2b16c82
Restore mathlib() so VxWorks build doesn't fail looking for libm
kuhlenough Nov 19, 2017
215bc2e
Reverse ifeq HAVE_DYNAMIC_LOADING logic in Makefile.pre.in
kuhlenough Nov 22, 2017
6921cf8
Merge remote-tracking branch 'upstream/master'
kuhlenough Dec 27, 2017
e62ed36
fix review issues
kuhlenough Dec 27, 2017
0861635
regenerated clinic/posixmodule.c.h
kuhlenough Dec 31, 2017
4d9158a
Merge remote-tracking branch 'upstream/master'
kuhlenough Dec 31, 2017
c6d7110
test
Jan 9, 2018
760da7a
record changes before I remove test code
Jan 15, 2018
1a0786f
wut
Jan 15, 2018
9752833
compiles
Jan 15, 2018
aeb5a6d
remove test files
Jan 15, 2018
dd24c10
remove unessecary files
Jan 15, 2018
e83c1d8
remove files
Jan 15, 2018
f1e3e72
fix setup.py
Jan 15, 2018
29c94e6
add PyList to char** code
Jan 16, 2018
4a59407
successfully exposed rtpSpawn
Jan 16, 2018
cf0fdd7
fixstuff
Jan 18, 2018
233711d
fix conflicts
Jan 18, 2018
a290567
configure changed
Jan 18, 2018
aa2e09f
not sure
Jan 18, 2018
18463dd
Fix static linking extensions
pablogsal Jan 21, 2018
db70b18
Add test for building extensions as builtins
pablogsal Jan 21, 2018
dd55e39
Add more extensions to the test
pablogsal Jan 21, 2018
0ad214f
Fix Windows Build
pablogsal Jan 21, 2018
7058513
Fix tests
Jan 23, 2018
a6e829f
stage before merging bpo32232
Jan 23, 2018
9a9e4c6
fix merge conflicts
Jan 23, 2018
ec4c065
Merge branch 'pablogsal-bpo32232' into oscar
Jan 23, 2018
1a3e146
Merge remote-tracking branch 'upstream/master'
kuhlenough Jan 23, 2018
4ec2302
refix os.pipe
Jan 23, 2018
fdda86b
temp
Jan 24, 2018
b73d9a5
Merge branch 'master' of https://github.com/python/cpython into oscar
Jan 24, 2018
e660837
fix random things
Jan 24, 2018
e4b940f
fixed root of bug
Jan 24, 2018
1e9e98c
add random support for vxworks
Jan 24, 2018
0d014f4
wat
Jan 26, 2018
228058d
fix leaking fds"
Jan 26, 2018
7fdefac
bpo-32726: Build macOS 10.9+ installer with private copy of Tcl/Tk 8.6
ned-deily Jan 30, 2018
9561d7f
Update NEWS, docs, and patchlevel for 3.7.0b1
ned-deily Jan 30, 2018
a582432
need to remove debug messages later
Jan 31, 2018
f5f8a74
finished 3.7.0b1 - on to b1+
ned-deily Jan 31, 2018
209108b
bpo-32727: smtplib's SMTP.send_message behaves differently with from_…
matrixise Jan 31, 2018
57750be
bpo-30693: zip+tarfile: sort directory listing (#2263)
bmwiedemann Jan 31, 2018
86fdad0
bpo-32583: Fix possible crashing in builtin Unicode decoders (#5325)
zhangyangyu Jan 31, 2018
f3da70f
Make site documentation more clear (#5461)
zhangyangyu Jan 31, 2018
70e3042
bpo-32735: Fix typo in f-strings datetime format specifier example (G…
csabella Jan 31, 2018
7f38637
Update Doc build for split off of 3.7 branch
ned-deily Jan 31, 2018
4d65430
bpo-32565: Add missed versionadded directives for all new opcodes. (G…
miss-islington Feb 1, 2018
78758f2
[3.7] bpo-32711: Fix warnings for Python/ast_unparse.c (GH-5426) (#5475)
miss-islington Feb 1, 2018
71a0b0e
Implement TimerHandle.when() (GH-5473) (GH-5480)
miss-islington Feb 1, 2018
5d2dcd0
Fix typo in hamt.c comments (GH-5478) (#5484)
miss-islington Feb 2, 2018
7876778
bpo-32436: Fix compiler warning (GH-5483) (GH-5486)
miss-islington Feb 2, 2018
e985afc
bpo-32674: Improve the docstring for __import__ (GH-5339) (GH-5488)
miss-islington Feb 2, 2018
709f6ad
bpo-32733: Make test_coroutines robust against -Werror (GH-5487) (GH-…
miss-islington Feb 2, 2018
29fd9ea
Revert "bpo-31356: Add context manager to temporarily disable GC GH-5…
miss-islington Feb 2, 2018
9ea42d2
test
Feb 2, 2018
c7de1d7
bpo-32614: Modify re examples to use a raw string to prevent warning …
miss-islington Feb 2, 2018
2b5937e
bpo-32734: Fix asyncio.Lock multiple acquire safety issue (GH-5466) (…
miss-islington Feb 2, 2018
a23d30f
bpo-32303 - Consistency fixes for namespace loaders (GH-5481) (#5503)
warsaw Feb 3, 2018
f33eced
bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (GH…
miss-islington Feb 3, 2018
52f7458
bpo-32739: Show default value for rotate() (GH-5485) (GH-5514)
miss-islington Feb 3, 2018
e86db34
[3.7] bpo-32746: Fix multiple typos (GH-5144) (GH-5520)
miss-islington Feb 4, 2018
133514e
bpo-32720: Fixed the definition for width and precision in format min…
miss-islington Feb 4, 2018
1a0239e
[3.7] bpo-32691: Use mod_spec.parent when running modules with pdb (G…
miss-islington Feb 4, 2018
e6499a0
Use assertTrue() instead of deprecated assert_(). (GH-5526) (GH-5527)
miss-islington Feb 4, 2018
5c5e61b
Fix typo -- missing "not" (GH-5528) (GH-5530)
miss-islington Feb 4, 2018
5b933aa
bpo-32765: Update configdialog General tab create page docstring (GH-…
miss-islington Feb 4, 2018
4abcbc0
bpo-30928: IDLE - update NEWS.txt. (GH-5539) (GH-5540)
miss-islington Feb 5, 2018
fea0a12
[3.7] bpo-8722: Document __getattr__ behavior with AttributeError in …
miss-islington Feb 5, 2018
2bb0bfa
bpo-32777: Fix _Py_set_inheritable async-safety in subprocess (GH-556…
miss-islington Feb 6, 2018
9197e5d
add timeout
Feb 6, 2018
2c6f668
bpo-30693: Fix tarfile test cleanup on MSWindows (GH-5557) (GH-5567)
miss-islington Feb 6, 2018
4e7a964
bpo-6135: Fix subprocess.check_output doc to mention changes in 3.6 (…
miss-islington Feb 7, 2018
a702f6b
Fix typo in whatsnew/3.7.rst (GH-5551) (GH-5553)
miss-islington Feb 7, 2018
a747cf6
bpo-32720: Fixed the replacement field grammar documentation. (GH-554…
miss-islington Feb 7, 2018
e1f0fd9
test
Feb 7, 2018
9dad132
change char to wchar
Feb 8, 2018
ad3997c
bpo-32802: Fix Travis build (GH-5589) (GH-5590)
miss-islington Feb 8, 2018
fbe4165
fix problem with sysroot addition;
Feb 8, 2018
ac8e483
Merge branch 'master' into oscar
Feb 8, 2018
73aaf36
add vxwapi as shared lib
Feb 8, 2018
105fcbf
bpo-32585: Add tkinter.ttk.Spinbox. (GH-5221) (GH-5592)
miss-islington Feb 9, 2018
0e36173
bpo-32775: Fix regular expression warnings in fnmatch. (GH-5583) (GH-…
miss-islington Feb 9, 2018
3a047a7
Make formatting of some return codes conforming to the general style.…
miss-islington Feb 9, 2018
7df8049
Fix some warnings produced by different compilers. (GH-5593) (GH-5600)
miss-islington Feb 9, 2018
b82e97b
Shared Libs finalyl works! site.py had a abspath function that needed…
Feb 9, 2018
2ef69a1
bpo-30157: Fix csv.Sniffer.sniff() regex pattern. (GH-5601) (GH-5602)
miss-islington Feb 9, 2018
e39429a
travis: Use -O3 option (GH-5599)
miss-islington Feb 10, 2018
e603320
bpo-32800: Update link to w3c doc for xml default namespaces (GH-5609…
miss-islington Feb 10, 2018
170b3f7
bpo-32792: Preserve mapping order in ChainMap() (GH-5586) (#GH-5617)
miss-islington Feb 11, 2018
a0b998d
bpo-11015: Update test.support documentation (GH-5619)
miss-islington Feb 11, 2018
fe61e8d
bpo-32604: Make _xxsubinterpreters build on Windows (GH-5624)
miss-islington Feb 11, 2018
40f7d9a
[3.7] Add short-circuit for doc changes to AppVeyor (GH-5626)
zware Feb 11, 2018
09df4b7
Fix AppVeyor doc short-circuit (GH-5633)
miss-islington Feb 11, 2018
ba4f218
bpo-32815: Improve docs on the subprocess API *text* parameter (GH-56…
miss-islington Feb 11, 2018
972edd9
Fix typo in Include/objimpl.h, the word "has" was missing (GH-5568) (…
miss-islington Feb 12, 2018
7041c76
remove debug messages; add def for gethostbyaddr
Feb 12, 2018
85f315b
remove broken ifdef
Feb 12, 2018
83b8cd8
fix static builds
Feb 12, 2018
0442599
bpo-32221: makeipaddr(): remove interface part + speedup (GH-5449) (G…
miss-islington Feb 12, 2018
38b4dd7
bpo-32826: Add "encoding=utf-8" to open() in idle_test/test_help_abou…
miss-islington Feb 12, 2018
74ebbae
bpo-29248: Fix os.readlink() on Windows (GH-5577)
miss-islington Feb 12, 2018
65c32bb
bpo-32837: IDLE - require encoding argument for textview.view_file. (…
miss-islington Feb 12, 2018
09819ef
bpo-32827: Fix usage of _PyUnicodeWriter_Prepare() in decoding errors…
miss-islington Feb 13, 2018
53374cc
bpo-30579: Docs for dynamic traceback creation (GH-5653)
miss-islington Feb 13, 2018
9b5a90b
bpo-32370: Use the correct encoding for ipconfig output in the uuid m…
miss-islington Feb 13, 2018
ef20abe
bpo-31787: Prevent refleaks when calling __init__() more than once (G…
miss-islington Feb 13, 2018
e81a6c8
bpo-31787: Skip refleak check when _hashlib is not available (GH-5660)
miss-islington Feb 13, 2018
2e8d900
bpo-27846: Delete incorrect note in base64 docs (GH-5666)
miss-islington Feb 14, 2018
deab193
remove mercurial dot files (GH-5558)
miss-islington Feb 14, 2018
8e29fd4
Fix installation instructions for *nix (GH-5605)
miss-islington Feb 14, 2018
8caee0f
bpo-32841: Fix cancellation in awaiting asyncio.Condition (GH-5665)
miss-islington Feb 14, 2018
7bc49fb
actually fix wrong module builds whne converting to use _vxworks inst…
Feb 14, 2018
f0616ce
Update comment in posixmodule.c (GH-5681)
miss-islington Feb 14, 2018
960dec6
link the proper alloca for ctypes
Feb 14, 2018
f26b019
Update and sync importlib.resources documentation (GH-5694) (#5697)
miss-islington Feb 16, 2018
af6eaae
bpo-32436: Add docs for contextvars (GH-5685)
miss-islington Feb 16, 2018
7b76b99
add proper include flags for openssl build
Feb 16, 2018
803e1a5
Correct the code example in Python 3.7's What's New (GH-5696)
miss-islington Feb 16, 2018
5588990
VxWorks doesnt support O_NONBLOCK Flag
Feb 16, 2018
3db05a3
bpo-32604: Clean up created subinterpreters before runtime finalizati…
miss-islington Feb 17, 2018
0f76411
bpo-32860: Fix a missing asterisk in the documentation for glob.iglob…
miss-islington Feb 17, 2018
025544a
DOC: fix documentation for copyright and credits (GH-5706)
miss-islington Feb 17, 2018
afb5e55
bpo-32852: Fix trace changing sys.argv to tuple. (GH-5692)
miss-islington Feb 17, 2018
aeb5d73
Fix a typo in asyncio docs (GH-5721)
miss-islington Feb 17, 2018
d5be8e1
bpo-30638: Add clinic to `make regen-all` (GH-5671)
miss-islington Feb 18, 2018
fa9a502
[3.7] Improves the ability to build in CI (GH-5729)
miss-islington Feb 18, 2018
7da582d
Clean up Travis config (GH-5727)
miss-islington Feb 18, 2018
3892899
bpo-31333: Re-implement ABCMeta in C (GH-5733)
ilevkivskyi Feb 18, 2018
0442de5
bpo-25988: Emit a warning when use or import ABCs from 'collections'.…
ilevkivskyi Feb 18, 2018
2e84e47
bpo-25988: add NEWS entry for 3.7.0b2 (#5743)
ned-deily Feb 18, 2018
ca82e3c
bpo-32869: Fix incorrect dst buffer size for MultiByteToWideChar (GH-…
miss-islington Feb 18, 2018
034a945
bpo-31333: Fix typo in whatsnew/3.7.rst (GH-5744)
miss-islington Feb 18, 2018
19b7f66
bpo-31972: Improve docstrings for pathlib classes (GH-5310)
miss-islington Feb 19, 2018
2072c80
Improve error message for "setup.py upload" without dist files (GH-21…
miss-islington Feb 19, 2018
0cd3581
bpo-32682: Improve libz version parsing in test_zilb (GH-5347)
miss-islington Feb 19, 2018
622a824
bpo-30121: Fix test_subprocess for Windows Debug builds (GH-5758)
miss-islington Feb 19, 2018
a3d6c1b
bpo-32409: Ensures activate.bat can handle Unicode contents (GH-5765)
miss-islington Feb 20, 2018
bab4fe3
closes bpo-32859: Don't retry dup3() if it is not available at runtim…
miss-islington Feb 20, 2018
1d927d4
bpo-31848: Fix broken error handling in Aifc_read.initfp() when the S…
miss-islington Feb 20, 2018
eed3c7a
bpo-32604: Swap threads only if the interpreter is different. (gh-5783)
miss-islington Feb 21, 2018
98a86cb
bpo-32540: Update venv documentation (GH-5736)
miss-islington Feb 21, 2018
7452f6d
bpo-28886: doc: Move deprecated abc decorators to separate section (G…
miss-islington Feb 21, 2018
e5d38de
bpo-32008: don't use PROTOCOL_TLSv1 in example (GH-5789)
miss-islington Feb 21, 2018
69607b4
bpo-32889: update valgrind suppressions (GH-5779)
miss-islington Feb 21, 2018
c59bc98
bpo-32874: IDLE: add tests for pyparse (GH-5755)
miss-islington Feb 22, 2018
bc2e110
closes bpo-32898: Fix debug build crash with COUNT_ALLOCS (GH-5800)
miss-islington Feb 22, 2018
dfa1144
bpo-32905: IDLE - remove unused code in pyparse module (GH-5807)
miss-islington Feb 22, 2018
01dd52f
bpo-32556: nt._getfinalpathname, nt._getvolumepathname and nt._getdis…
miss-islington Feb 22, 2018
e5a9b35
bpo-32457: Improves handling of denormalized executable path when lau…
miss-islington Feb 22, 2018
b4c6bdc
merge
Feb 22, 2018
21fb278
fix redef issue with NONE in _pickle
Feb 22, 2018
640cce7
increase subprocess size
Feb 26, 2018
f64606e
remove all debug messages
Feb 26, 2018
8f2516a
fix broken else
Feb 28, 2018
d16ad7f
move subprocess pipe duplicate into more reasonable placeds and repla…
Feb 28, 2018
bf0607a
fix bug with spawned subprocess not closing p2cwrite
Mar 1, 2018
785ced6
restore correct path after spawning subprocess
Mar 2, 2018
084256d
switch default encoding to ascii
Mar 2, 2018
7d62768
fix hash randomization at initialization
Mar 2, 2018
dd7460b
skip some test cases
Mar 2, 2018
61490c0
ensure correct openssl libs included
Mar 5, 2018
4ca9f18
forgot test
Mar 6, 2018
8092657
keep fixing test cases
Mar 21, 2018
22701dd
lost a days worth of work cuz forgot to push before rebuild >.>, this…
Mar 22, 2018
768c619
skip osfork tests
Mar 22, 2018
36b0634
whoops on beginswith
Mar 22, 2018
0ba5ab7
skip ssl tests if vxworks
Mar 27, 2018
dc42724
idk
Mar 27, 2018
c79857f
expose and use vxworks pathIsAbsolute
Mar 28, 2018
cdaa817
realpath is currently broken
Mar 28, 2018
217b2d9
fix random
Apr 5, 2018
61a4f27
keep fixing test modules
Apr 9, 2018
92465c7
keep fixing path issues
Apr 10, 2018
0461bda
skip test
Apr 10, 2018
72b343d
fixed select blocking
Apr 10, 2018
f569783
fix last commit
Apr 10, 2018
8598648
yeah no select isnt fixed yet
Apr 10, 2018
875bb82
Merge pull request #2 from kuhlenough/oscar
kuhlenough Apr 16, 2018
addd1a0
Merge remote-tracking branch 'upstream/master'
kuhlenough Apr 16, 2018
37b7dc8
remove debug print
ooosssososos Apr 16, 2018
a74b6d6
Merge pull request #3 from kuhlenough/oscar
ooosssososos Apr 16, 2018
fc9529f
remove testing code
ooosssososos Apr 16, 2018
cc3d30b
remove testing code
ooosssososos Apr 16, 2018
df4b6ff
fixed the random problem in vxworks seeding
ooosssososos Apr 16, 2018
39e4d4e
change modificitation to skip
ooosssososos Apr 16, 2018
f2682d6
remove #endif
ooosssososos Apr 16, 2018
ddde264
Merge pull request #4 from kuhlenough/oscar
ooosssososos Apr 16, 2018
d0c89e4
Revert "Update Doc build for split off of 3.7 branch"
kuhlenough Apr 16, 2018
69ff954
Merge branch 'master' of https://github.com/kuhlenough/cpython
kuhlenough Apr 17, 2018
d5127ac
Revert "Fix static linking extensions"
kuhlenough Apr 17, 2018
d0ecc40
Revert "Fix Windows Build"
kuhlenough Apr 17, 2018
43aeefc
Revert "Add more extensions to the test"
kuhlenough Apr 17, 2018
0b620c4
revert linefeed changes
kuhlenough Apr 17, 2018
79f497a
Revert "Fix static linking extensions"
kuhlenough Apr 17, 2018
cbcfdf9
clean-up cruff
kuhlenough Apr 17, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/tools/static/switchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

var all_versions = {
'3.8': 'dev (3.8)',
'3.7': 'pre (3.7)',
'3.7': 'pre (3.7)',
'3.6': '3.6',
'3.5': '3.5',
'2.7': '2.7',
Expand Down
4 changes: 4 additions & 0 deletions Include/osdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ extern "C" {
#define DELIM L';'
#endif

#ifdef __VXWORKS__
#define DELIM L';'
#endif

/* Filename separator */
#ifndef SEP
#define SEP L'/'
Expand Down
4 changes: 4 additions & 0 deletions Include/symtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
#define SCOPE_OFFSET 11
#define SCOPE_MASK (DEF_GLOBAL | DEF_LOCAL | DEF_PARAM | DEF_NONLOCAL)

#ifdef __VXWORKS__
#undef LOCAL
#endif

#define LOCAL 1
#define GLOBAL_EXPLICIT 2
#define GLOBAL_IMPLICIT 3
Expand Down
7 changes: 7 additions & 0 deletions Lib/multiprocessing/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,13 @@ def _flush_std_streams():
#

def spawnv_passfds(path, args, passfds):
if 'vxworks' in sys.platform:
import subprocess
try:
return subprocess.Popen(args).pid
except:
Copy link
Member

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:

def spawnv_passfds(...):
    ...

if 'vxworks' in sys.platform:
  # a comment explaining why this is needed
  def spawnv_passfds(...):
    # implementation of vxworks special version

pass
return
import _posixsubprocess
passfds = tuple(sorted(map(int, passfds)))
errpipe_read, errpipe_write = os.pipe()
Expand Down
4 changes: 2 additions & 2 deletions Lib/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Member

Choose a reason for hiding this comment

The 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()
Expand All @@ -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)
Expand Down
24 changes: 21 additions & 3 deletions Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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))
Copy link
Member

Choose a reason for hiding this comment

The 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
Expand Down Expand Up @@ -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:]
Copy link
Member

Choose a reason for hiding this comment

The 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)
Expand Down
109 changes: 96 additions & 13 deletions Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import sys
_mswindows = (sys.platform == "win32")
_vxworks = (sys.platform == "vxworks")

import io
import os
Expand Down Expand Up @@ -136,7 +137,10 @@ def __init__(self, *, dwFlags=0, hStdInput=None, hStdOutput=None,
self.wShowWindow = wShowWindow
self.lpAttributeList = lpAttributeList or {"handle_list": []}
else:
import _posixsubprocess
if(_vxworks):
import _vxwapi
else:
import _posixsubprocess
import select
import selectors
import threading
Expand Down Expand Up @@ -605,9 +609,11 @@ class Popen(object):
preexec_fn: (POSIX only) An object to be called in the child process
just before the child is executed.

close_fds: Controls closing or inheriting of file descriptors.
close_fds: Controls closing or inheriting of file descriptors.
(not supported on VxWorks)

shell: If true, the command will be executed through the shell.
(not supported on VxWorks)

cwd: Sets the current directory before the child is executed.

Expand Down Expand Up @@ -636,7 +642,7 @@ class Popen(object):

def __init__(self, args, bufsize=-1, executable=None,
stdin=None, stdout=None, stderr=None,
preexec_fn=None, close_fds=True,
preexec_fn=None, close_fds=False,
shell=False, cwd=None, env=None, universal_newlines=None,
startupinfo=None, creationflags=0,
restore_signals=True, start_new_session=False,
Expand All @@ -661,7 +667,23 @@ def __init__(self, args, bufsize=-1, executable=None,
if preexec_fn is not None:
raise ValueError("preexec_fn is not supported on Windows "
"platforms")


else:
# VxWorks
if _vxworks:
if shell:
raise ValueError("shell is not supported on VxWorks")
if preexec_fn is not None:
raise ValueError("Preexecution function is not supported on"
"VxWorks");
if close_fds:
raise ValueError("close_fds is not supported on VxWorks")

if start_new_session:
raise ValueError("VxWorks does not support sessions");


# POSIX
if pass_fds and not close_fds:
warnings.warn("pass_fds overriding close_fds.", RuntimeWarning)
Expand Down Expand Up @@ -891,6 +913,9 @@ def communicate(self, input=None, timeout=None):
universal_newlines.
"""

if _vxworks:
timeout=30

if self._communication_started and input:
raise ValueError("Cannot send input after starting communication")

Expand Down Expand Up @@ -1366,6 +1391,7 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
restore_signals, start_new_session):
"""Execute program (POSIX version)"""


if isinstance(args, (str, bytes)):
args = [args]
else:
Expand Down Expand Up @@ -1420,7 +1446,62 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
for dir in os.get_exec_path(env))
fds_to_keep = set(pass_fds)
fds_to_keep.add(errpipe_write)
self.pid = _posixsubprocess.fork_exec(
if(_vxworks):
#Hack method to have child spawn with correct FD's
#copy parent std fds
#set parent stdfd's as desired child fds
#spawn child
#resture parent stdfds to std values
#
#!!!Massive caveat in that the child inherits all pipes
tmp_stdin = None;
tmp_stdout = None;
tmp_stderr = None;
#save old stdio fds
#replace stdiofds with desired child fds
if c2pwrite >= 0:
tmp_stdout = os.dup(1);
os.dup2(c2pwrite, 1);

if p2cread >= 0:
tmp_stdin = os.dup(0);
os.dup2(p2cread, 0);

if errwrite >= 0:
tmp_stderr = os.dup(2);
os.dup2(errwrite, 2);
tmp_cwd = None;
if cwd:
tmp_cwd = os.getcwd()
os.chdir(cwd)
if env_list is None:
env_list = [envKey + "=" + envVal for envKey,envVal in os.environ.copy().items()]
else:
env_list = [envKey + "=" + envVal for envKey,envVal in env.items()] #Sacrifice efficiency for readability
if p2cwrite > 2:
env_list.append("closeFD="+str(p2cwrite))
self.pid = _vxwapi.rtpSpawn(
executable_list[0].decode("UTF-8"),
args,env_list, 100,0x1000000,0,0)
if tmp_cwd is not None:
os.chdir(tmp_cwd)


if tmp_stdin is not None:
os.dup2(tmp_stdin, 0)
os.close(tmp_stdin)

if tmp_stdout is not None:
os.dup2(tmp_stdout, 1)
os.close(tmp_stdout)

if tmp_stderr is not None:
os.dup2(tmp_stderr, 2)
os.close(tmp_stderr)


else:
self.pid = _posixsubprocess.fork_exec(
args, executable_list,
close_fds, tuple(sorted(map(int, fds_to_keep))),
cwd, env_list,
Expand Down Expand Up @@ -1450,6 +1531,8 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
# exception (limited in size)
errpipe_data = bytearray()
while True:
if _vxworks:
break
part = os.read(errpipe_read, 50000)
errpipe_data += part
if not part or len(errpipe_data) > 50000:
Expand Down Expand Up @@ -1623,7 +1706,6 @@ def _communicate(self, input, endtime, orig_timeout):

stdout = None
stderr = None

# Only create this mapping if we haven't already.
if not self._communication_started:
self._fileobj2output = {}
Expand All @@ -1641,7 +1723,6 @@ def _communicate(self, input, endtime, orig_timeout):

if self._input:
input_view = memoryview(self._input)

with _PopenSelector() as selector:
if self.stdin and input:
selector.register(self.stdin, selectors.EVENT_WRITE)
Expand All @@ -1653,11 +1734,16 @@ def _communicate(self, input, endtime, orig_timeout):
while selector.get_map():
timeout = self._remaining_time(endtime)
if timeout is not None and timeout < 0:
raise TimeoutExpired(self.args, orig_timeout)

if not _vxworks:
raise TimeoutExpired(self.args, orig_timeout)
else:
break;
ready = selector.select(timeout)
self._check_timeout(endtime, orig_timeout)

#TODO Also a temporary workaround for V7COR-5635
if not _vxworks:
self._check_timeout(endtime, orig_timeout)
else:
pass
# XXX Rewrite these to use non-blocking I/O on the file
# objects; they are no longer using C stdio!

Expand All @@ -1678,11 +1764,8 @@ def _communicate(self, input, endtime, orig_timeout):
data = os.read(key.fd, 32768)
if not data:
selector.unregister(key.fileobj)
key.fileobj.close()
self._fileobj2output[key.fileobj].append(data)

self.wait(timeout=self._remaining_time(endtime))

# All data exchanged. Translate lists into strings.
if stdout is not None:
stdout = b''.join(stdout)
Expand Down
1 change: 1 addition & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -5384,6 +5384,7 @@ def test_gaps(self):
ldt = tz.fromutc(udt.replace(tzinfo=tz))
self.assertEqual(ldt.fold, 0)

@unittest.skipIf('vxworks' in sys.platform, "NOT SUPPORTED ON VXWORKS")
def test_system_transitions(self):
if ('Riyadh8' in self.zonename or
# From tzdata NEWS file:
Expand Down
6 changes: 5 additions & 1 deletion Lib/test/libregrtest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
except ImportError:
gc = None

_vxworks = sys.platform == "vxworks";

# When tests are run from the Python build directory, it is best practice
# to keep the test files in a subfolder. This eases the cleanup of leftover
Expand Down Expand Up @@ -422,8 +423,11 @@ def _test_forever(self, tests):
def display_header(self):
# Print basic platform information
print("==", platform.python_implementation(), *sys.version.split())
print("==", platform.platform(aliased=True),
if not _vxworks:
print("==", platform.platform(aliased=True),
"%s-endian" % sys.byteorder)
else:
print("VxWorks 7");
print("== cwd:", os.getcwd())
cpu_count = os.cpu_count()
if cpu_count:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_asynchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_empty_line(self):

self.assertEqual(c.contents,
[b"hello world", b"", b"I'm not dead yet!"])

@unittest.skipIf("vxworks" in sys.platform, 'vxworks doesnt inform the server side when the client disconnects')
def test_close_when_done(self):
s, event = start_echo_server()
s.start_resend_event = threading.Event()
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_asyncore.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

TIMEOUT = 3
HAS_UNIX_SOCKETS = hasattr(socket, 'AF_UNIX')
if "vxworks" in sys.platform:
HAS_UNIX_SOCKETS = False

class dummysocket:
def __init__(self):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ def test_baddecorator(self):


class ShutdownTest(unittest.TestCase):

@unittest.skipIf(sys.platform == "vxworks", "VxWorks: V7COR-5635 Needs to be fixed before this runs")
def test_cleanup(self):
# Issue #19255: builtins are still available at shutdown
code = """if 1:
Expand Down
3 changes: 3 additions & 0 deletions Lib/test/test_cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ def test_non_ascii(self):
# arguments as unicode (using wmain() instead of main()).
@unittest.skipIf(sys.platform == 'win32',
'Windows has a native unicode API')
@unittest.skipIf('vxworks' in sys.platform,
"Not supported on VxWorks: main() does not support unicode arguments")
def test_undecodable_code(self):
undecodable = b"\xff"
env = os.environ.copy()
Expand Down Expand Up @@ -369,6 +371,7 @@ def test_closed_stdout(self):
# Issue #7111: Python should work without standard streams

@unittest.skipIf(os.name != 'posix', "test needs POSIX semantics")
@unittest.skipIf('vxworks' in sys.platform, "Not supported on VxWorks: No preexec fn")
def _test_no_stdio(self, streams):
code = """if 1:
import os, sys
Expand Down
Loading