-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: improved inclusion of header and source files
Should make it possible to handle missing header files.
- Loading branch information
Showing
4 changed files
with
87 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,91 +29,72 @@ | |
""" The license for the module """ | ||
|
||
import os | ||
import glob | ||
import setuptools | ||
|
||
def rename_sources(sources, base = ".c", target = ".cpp"): | ||
|
||
def rename_sources(sources, base=".c", target=".cpp"): | ||
renamed = [] | ||
for source in sources: | ||
source_extension = os.path.splitext(source)[1] | ||
if not source_extension == base: continue | ||
if not source_extension == base: | ||
continue | ||
source_name = os.path.splitext(source)[0] | ||
new_source_path = source_name + target | ||
os.rename(source, new_source_path) | ||
renamed.append(new_source_path) | ||
return renamed | ||
|
||
def rollback_sources(sources, base = ".cpp", target = ".c"): | ||
return rename_sources(sources, base = base, target = target) | ||
|
||
def rollback_sources(sources, base=".cpp", target=".c"): | ||
return rename_sources(sources, base=base, target=target) | ||
|
||
|
||
module = setuptools.Extension( | ||
"npcolony", | ||
define_macros = [ | ||
("MAJOR_VERSION", "1"), | ||
('MINOR_VERSION', '0') | ||
], | ||
include_dirs = [ | ||
".", | ||
"src/colony_npapi/", | ||
"/usr/local/include" | ||
], | ||
libraries = [ | ||
"user32", | ||
"gdi32", | ||
"winspool", | ||
"comdlg32" | ||
] if os.name in ("nt",) else ["cups"], | ||
library_dirs = ["/usr/local/lib"], | ||
extra_compile_args = [ | ||
"/DHAVE_LIBPYTHON", | ||
"/DHAVE_LIBPYTHON_UNDEF" | ||
] if os.name in ("nt",) else [ | ||
"-std=c99", | ||
"-pedantic", | ||
"-finline-functions", | ||
"-Wall", | ||
"-Wno-long-long", | ||
"-Wno-variadic-macros", | ||
"-Wno-strict-aliasing", | ||
"-Wno-strict-prototypes", | ||
"-DNO_CONFIG_H", | ||
"-DCOLONY_PLATFORM_UNIX" | ||
], | ||
sources = [ | ||
"src/colony_npapi/stdafx.c", | ||
"src/colony_npapi/encoding/base_64.c", | ||
"src/colony_npapi/plugin/base.c", | ||
"src/colony_npapi/plugin/python.c", | ||
"src/colony_npapi/plugin/util.c", | ||
"src/colony_npapi/print/print_unix.c", | ||
"src/colony_npapi/print/print_win32.c", | ||
"src/colony_npapi/system/gui_unix.c", | ||
"src/colony_npapi/system/gui_win32.c" | ||
] | ||
define_macros=[("MAJOR_VERSION", "1"), ("MINOR_VERSION", "0")], | ||
include_dirs=[".", "src/colony_npapi/", "/usr/local/include"], | ||
libraries=( | ||
["user32", "gdi32", "winspool", "comdlg32"] if os.name in ("nt",) else ["cups"] | ||
), | ||
library_dirs=["/usr/local/lib"], | ||
extra_compile_args=( | ||
["/DHAVE_LIBPYTHON", "/DHAVE_LIBPYTHON_UNDEF"] | ||
if os.name in ("nt",) | ||
else [ | ||
"-std=c99", | ||
"-pedantic", | ||
"-finline-functions", | ||
"-Wall", | ||
"-Wno-long-long", | ||
"-Wno-variadic-macros", | ||
"-Wno-strict-aliasing", | ||
"-Wno-strict-prototypes", | ||
"-DNO_CONFIG_H", | ||
"-DCOLONY_PLATFORM_UNIX", | ||
] | ||
), | ||
sources=glob.glob("src/colony_npapi/**/*.c") + glob.glob("src/colony_npapi/**/*.h"), | ||
) | ||
|
||
if os.name in ("nt",): | ||
module.sources = rename_sources(module.sources) | ||
try: | ||
setuptools.setup( | ||
name = "npcolony", | ||
version = "1.2.1", | ||
author = "Hive Solutions Lda.", | ||
author_email = "[email protected]", | ||
description = "Colony Framework", | ||
license = "Apache License, Version 2.0", | ||
keywords = "colony npapi native", | ||
url = "http://colony_npapi.hive.pt", | ||
packages = [ | ||
"npcolony_py", | ||
"npcolony_py.test" | ||
], | ||
test_suite = "npcolony_py.test", | ||
package_dir = { | ||
"" : os.path.normpath("src/python") | ||
}, | ||
zip_safe = False, | ||
ext_modules = [module], | ||
classifiers = [ | ||
name="npcolony", | ||
version="1.2.1", | ||
author="Hive Solutions Lda.", | ||
author_email="[email protected]", | ||
description="Colony Framework", | ||
license="Apache License, Version 2.0", | ||
keywords="colony npapi native", | ||
url="http://colony_npapi.hive.pt", | ||
packages=["npcolony_py", "npcolony_py.test"], | ||
test_suite="npcolony_py.test", | ||
package_dir={"": os.path.normpath("src/python")}, | ||
zip_safe=False, | ||
ext_modules=[module], | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Topic :: Utilities", | ||
"License :: OSI Approved :: Apache Software License", | ||
|
@@ -133,10 +114,14 @@ def rollback_sources(sources, base = ".cpp", target = ".c"): | |
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12" | ||
"Programming Language :: Python :: 3.12", | ||
], | ||
long_description = open(os.path.join(os.path.dirname(__file__), "README.md"), "rb").read().decode("utf-8"), | ||
long_description_content_type = "text/markdown" | ||
long_description=open( | ||
os.path.join(os.path.dirname(__file__), "README.md"), "rb" | ||
) | ||
.read() | ||
.decode("utf-8"), | ||
long_description_content_type="text/markdown", | ||
) | ||
finally: | ||
if os.name in ("nt",): | ||
|
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
import npcolony | ||
|
||
|
||
class GlobalTest(unittest.TestCase): | ||
|
||
def test_basic(self): | ||
|