diff --git a/contrib/.gitignore b/contrib/.gitignore index 33fa81ab6b..aa93cd250a 100644 --- a/contrib/.gitignore +++ b/contrib/.gitignore @@ -1,4 +1,9 @@ +*.pyc +*.pyo /__init__.py -/built/ +# These are files that are generated within the source tree by the +# ppremake system. Makefile pp.dep +/built/ +Opt?-* diff --git a/direct/.gitignore b/direct/.gitignore index 97b7fbcf49..aa93cd250a 100644 --- a/direct/.gitignore +++ b/direct/.gitignore @@ -1,4 +1,5 @@ *.pyc +*.pyo /__init__.py # These are files that are generated within the source tree by the # ppremake system. diff --git a/direct/src/extensions_native/core_extensions.py b/direct/src/extensions_native/core_extensions.py new file mode 100644 index 0000000000..3380dc3cf3 --- /dev/null +++ b/direct/src/extensions_native/core_extensions.py @@ -0,0 +1,28 @@ +import sys + +main_dir = Filename() + +if sys.argv and sys.argv[0]: + main_dir = Filename.from_os_specific(sys.argv[0]) + +if main_dir.empty(): + # We must be running in the Python interpreter directly, so return the CWD. + main_dir = ExecutionEnvironment.get_cwd() +else: + main_dir.make_absolute() + main_dir = Filename(main_dir.get_dirname()) +ExecutionEnvironment.shadow_environment_variable('MAIN_DIR', main_dir.to_os_specific()) +del sys, main_dir + + +def Dtool_funcToMethod(func, cls, method_name=None): + """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method. + The new method is accessible to any instance immediately.""" + #if sys.version_info < (3, 0): + # func.im_class = cls + func.im_func = func + func.im_self = None + if not method_name: + method_name = func.__name__ + cls.DtoolClassDict[method_name] = func; + diff --git a/makepanda/.gitignore b/makepanda/.gitignore index 94487b9516..c3667923e0 100644 --- a/makepanda/.gitignore +++ b/makepanda/.gitignore @@ -1 +1,2 @@ *.pyc +*.pyo diff --git a/panda/.gitignore b/panda/.gitignore index 3fbb4b2955..ec20cdb1ee 100644 --- a/panda/.gitignore +++ b/panda/.gitignore @@ -1,4 +1,5 @@ *.pyc +*.pyo # These are files that are generated within the source tree by the # ppremake system. Makefile