-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
147 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python3 | ||
import os.path | ||
import subprocess | ||
import sys | ||
|
||
_ROOT = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) | ||
|
||
# if 0: use the upstream version | ||
# if >0: append `.post1` / `.a1` as needed | ||
SERIAL = 1 | ||
|
||
|
||
def main() -> int: | ||
upstream = subprocess.check_output( | ||
(sys.executable, 'setup.pyuwsgi.py', '--version'), | ||
cwd=os.path.join(_ROOT, 'uwsgi'), | ||
).strip().decode() | ||
|
||
if os.path.exists('patches') and os.listdir('patches'): | ||
if not SERIAL: | ||
raise SystemExit('SERIAL must be >= 0 if there are patches!') | ||
append = 'a' | ||
# increment the final version segment to indicate a future pre-release | ||
parts = upstream.split('.') | ||
parts[-1] = str(int(parts[-1]) + 1) | ||
upstream = '.'.join(parts) | ||
else: | ||
append = '.post' | ||
|
||
if SERIAL: | ||
print(f'{upstream}{append}{SERIAL}') | ||
else: | ||
print(upstream) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
raise SystemExit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python3 | ||
import argparse | ||
import os.path | ||
import shutil | ||
import subprocess | ||
|
||
_ROOT = os.path.dirname(os.path.abspath(os.path.dirname(__file__))) | ||
|
||
|
||
def root_path(*s: str) -> str: | ||
return os.path.join(_ROOT, *s) | ||
|
||
|
||
_PACKAGE_VERSION = os.path.join(_ROOT, 'bin', 'package-version') | ||
|
||
|
||
def main() -> int: | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('uwsgi_dir') | ||
args = parser.parse_args() | ||
|
||
version = subprocess.check_output(_PACKAGE_VERSION).strip().decode() | ||
|
||
def uwsgi_path(*s: str) -> str: | ||
return os.path.join(args.uwsgi_dir, *s) | ||
|
||
# copy our setup.py over with the adjusted `version=` | ||
found_version_line = False | ||
with open(uwsgi_path('setup.py'), 'w') as setup_dest: | ||
with open(root_path('setup.py')) as setup_src: | ||
for line in setup_src: | ||
if line == ' version=uwsgiconfig.uwsgi_version + "",\n': | ||
found_version_line = True | ||
line = f' version={version!r},\n' | ||
setup_dest.write(line) | ||
if not found_version_line: | ||
raise AssertionError('failed to find `version=...` line in setup.py') | ||
|
||
# create a pyuwsginossl build configuration | ||
with open(uwsgi_path('buildconf', 'pyuwsginossl.ini'), 'w') as ini_dest: | ||
with open(uwsgi_path('buildconf', 'pyuwsgi.ini')) as ini_src: | ||
shutil.copyfileobj(ini_src, ini_dest) | ||
ini_dest.write('ssl = false\n') | ||
|
||
# remove stale PKG-INFO | ||
os.remove(uwsgi_path('PKG-INFO')) | ||
|
||
# apply patches (if applicable) | ||
if os.path.exists('patches'): | ||
patches = sorted(os.listdir(root_path('patches'))) | ||
for patch in patches: | ||
subprocess.check_call( | ||
('patch', '-p1', '-i', root_path('patches', patch)), | ||
cwd=uwsgi_path(), | ||
) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
raise SystemExit(main()) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
commit bfa363472bfb861a02bdeefc7477fcab04091c66 | ||
Author: Anthony Sottile <[email protected]> | ||
Date: Mon Aug 19 15:50:31 2024 -0400 | ||
|
||
avoid interleaving pywsgi threadstate | ||
|
||
diff --git a/plugins/pyuwsgi/pyuwsgi.c b/plugins/pyuwsgi/pyuwsgi.c | ||
index 7a4f2249..11732e04 100644 | ||
--- a/plugins/pyuwsgi/pyuwsgi.c | ||
+++ b/plugins/pyuwsgi/pyuwsgi.c | ||
@@ -126,13 +126,6 @@ PyObject *pyuwsgi_setup(PyObject * self, PyObject * args, PyObject * kwds) { | ||
return NULL; | ||
} | ||
|
||
- | ||
- //TODO: ...??? | ||
- // actually do the thing! | ||
- PyThreadState *_tstate = PyThreadState_Get(); | ||
- uwsgi_setup(orig_argc, orig_argv, environ); | ||
- PyThreadState_Swap(_tstate); | ||
- | ||
Py_INCREF(self); | ||
return self; | ||
} | ||
@@ -143,6 +136,7 @@ PyObject *pyuwsgi_init(PyObject * self, PyObject * args, PyObject * kwds) { | ||
return NULL; | ||
} | ||
|
||
+ uwsgi_setup(orig_argc, orig_argv, environ); | ||
int rc = uwsgi_run(); | ||
|
||
// never(?) here | ||
@@ -156,6 +150,7 @@ PyObject *pyuwsgi_run(PyObject * self, PyObject * args, PyObject * kwds) { | ||
return NULL; | ||
} | ||
|
||
+ uwsgi_setup(orig_argc, orig_argv, environ); | ||
int rc = uwsgi_run(); | ||
|
||
// never(?) here |