Thread: [pywin32-checkins] pywin32 setup_win32all_core.py,1.5,1.6
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <th...@us...> - 2003-11-05 21:30:07
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv3209 Modified Files: setup_win32all_core.py Log Message: There is a chance for distutils, even in the win32all build process! This encourages me to further work on this script. The specialized code for pywintypes and pythoncom should be clearer now, at least to me. Unfortunately, I broke mingw32 support. But even before this, I get compilation errors with mingw. An example: win32/src/PyACL.cpp: In function `BOOL _ReorderACL(_ACL*)': win32/src/PyACL.cpp:89: `ACCESS_DENIED_OBJECT_ACE_TYPE' undeclared (first use this function) win32/src/PyACL.cpp:89: (Each undeclared identifier is reported only once for each function it appears in.) error: command 'gcc' failed with exit status 1 If someone tells me how this can be fixed I'll happy to also bring this up to date for mingw. swig is now supported (.i sources are parsed out of the dsp files), and I can at least build pywintypes, win32api, win32file, win32event, pythoncom. Whether they work or not - I cannot currently tell. install_lib does no longer work, requires rethought: Some files should be installed in the normal way, others go into sysdir. Index: setup_win32all_core.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup_win32all_core.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** setup_win32all_core.py 22 Aug 2003 19:58:27 -0000 1.5 --- setup_win32all_core.py 5 Nov 2003 21:10:27 -0000 1.6 *************** *** 8,11 **** --- 8,12 ---- from distutils.command.build_ext import build_ext from distutils.dep_util import newer_group + from distutils import log import os, string, sys *************** *** 33,37 **** include_dirs = ['com/win32com/src/include', 'win32/src'] + include_dirs ! libraries = ['user32', 'odbc32', 'advapi32', 'oleaut32', 'ole32', 'shell32'] + libraries --- 34,38 ---- include_dirs = ['com/win32com/src/include', 'win32/src'] + include_dirs ! libraries = ['user32', 'odbc32', 'advapi32', 'version', 'oleaut32', 'ole32', 'shell32'] + libraries *************** *** 74,78 **** fields = line.strip().split("=", 2) if fields[0]=="SOURCE": ! if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c']: pathname = os.path.normpath(os.path.join(dsp_path, fields[1])) result.append(pathname) --- 75,79 ---- fields = line.strip().split("=", 2) if fields[0]=="SOURCE": ! if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c', '.i']: pathname = os.path.normpath(os.path.join(dsp_path, fields[1])) result.append(pathname) *************** *** 81,116 **** ################################################################ - pywintypes = WinExt('pywintypes', - dsp_file = r"win32\PyWinTypes.dsp", - extra_compile_args = ['-DBUILD_PYWINTYPES'] - ) - - pythoncom = WinExt('pythoncom', - dsp_file=r"com\win32com.dsp", - export_symbol_file = 'com/win32com/src/PythonCOM.def', - ## libraries = ['PyWintypes'], - extra_compile_args = ['-DBUILD_PYTHONCOM'], - ) - - class my_install_lib (install_lib): # A special install_lib command, which will install into the windows # system directory instead of Lib/site-packages def finalize_options(self): install_lib.finalize_options(self) self.install_dir = os.getenv("windir") + '\\system32' - WINVER = tuple(map(int, string.split(sys.winver, '.'))) - - REGNAMES = {'pywintypes': 'PyWinTypes%d%d' % WINVER, - 'pythoncom': 'PythonCOM%d%d' % WINVER, - } - - class my_build_ext(build_ext): def finalize_options(self): build_ext.finalize_options(self) ! self.library_dirs.append(self.build_temp) self.mingw32 = (self.compiler == "mingw32") --- 82,100 ---- ################################################################ class my_install_lib (install_lib): # A special install_lib command, which will install into the windows # system directory instead of Lib/site-packages + + # XXX Currently broken. Should only install pywintypes and pythoncom into sysdir def finalize_options(self): install_lib.finalize_options(self) self.install_dir = os.getenv("windir") + '\\system32' class my_build_ext(build_ext): def finalize_options(self): build_ext.finalize_options(self) ! # The pywintypes library is created in the build_temp ! # directory, so we need to add this to library_dirs self.library_dirs.append(self.build_temp) self.mingw32 = (self.compiler == "mingw32") *************** *** 121,126 **** # some source files are compiled for different extensions # with special defines. So we cannot use a shared ! # directory for objects, we must use special ones. ! old_temp = self.build_temp try: self.build_temp = os.path.join(self.build_temp, ext.name) --- 105,110 ---- # some source files are compiled for different extensions # with special defines. So we cannot use a shared ! # directory for objects, we must use a special one for each extension. ! old_build_temp = self.build_temp try: self.build_temp = os.path.join(self.build_temp, ext.name) *************** *** 128,178 **** build_ext.build_extension(self, ext) ! # After building an extension with non-standard target filename, ! # copy the .lib-file created to the original name. ! name = REGNAMES.get(ext.name, ext.name) ! from distutils.file_util import copy_file, move_file ! extra = '' ! if self.debug: ! extra = '_d' ! if self.mingw32: ! prefix = 'lib' ! extra = extra + '.a' ! else: ! prefix = '' ! extra = extra + '.lib' # MSVCCompiler constructs the .lib file in the same directory # as the first source file's object file: # os.path.dirname(objects[0]) src = os.path.join(self.build_temp, os.path.dirname(ext.sources[0]), ! prefix + name + extra) ! dst = os.path.join(self.build_temp, "..", prefix + ext.name + extra) self.copy_file(src, dst)#, update=1) finally: ! self.build_temp = old_temp ! def get_libraries(self, ext): ! libs = build_ext.get_libraries(self, ext) ! result = [] ! for lib in libs: ! plib = REGNAMES.get(string.lower(lib), None) ! if plib and self.debug: ! plib = plib + '_d' ! if plib: ! result.append(plib) else: ! result.append(lib) ! return result ! def get_ext_filename(self, name): ! fname = build_ext.get_ext_filename(self, name) ! base, ext = os.path.splitext(fname) ! newbase = REGNAMES.get(name, fname) ! if self.debug: ! return newbase + '_d' + '.dll' ! return newbase + '.dll' setup(name="PyWinTypes", --- 112,217 ---- build_ext.build_extension(self, ext) ! if ext.name not in ("pywintypes", "pythoncom"): ! return ! ! # The import libraries are created as PyWinTypes23.lib, but ! # are expected to be pywintypes.lib. ! ! # XXX This has to be changed for mingw32 ! extra = self.debug and "_d.lib" or ".lib" ! if ext.name == "pywintypes": ! name1 = "pywintypes%d%d%s" % (sys.version_info[0], sys.version_info[1], extra) ! name2 = "pywintypes%s" % (extra) ! elif ext.name == "pythoncom": ! name1 = "pythoncom%d%d%s" % (sys.version_info[0], sys.version_info[1], extra) ! name2 = "pythoncom%s" % (extra) # MSVCCompiler constructs the .lib file in the same directory # as the first source file's object file: # os.path.dirname(objects[0]) + # but we want it in the (old) build_temp directory src = os.path.join(self.build_temp, os.path.dirname(ext.sources[0]), ! name1) ! dst = os.path.join(old_build_temp, name2) self.copy_file(src, dst)#, update=1) finally: ! self.build_temp = old_build_temp + def get_ext_filename(self, name): + # The pywintypes and pythoncom extensions have special names + if name == "pywintypes": + extra = self.debug and "_d.dll" or ".dll" + return "pywintypes%d%d%s" % (sys.version_info[0], sys.version_info[1], extra) + elif name == "pythoncom": + extra = self.debug and "_d.dll" or ".dll" + return "pythoncom%d%d%s" % (sys.version_info[0], sys.version_info[1], extra) + return build_ext.get_ext_filename(self, name) ! def find_swig (self): ! # We know where swig is ! os.environ["SWIG_LIB"] = os.path.abspath(r"swig\swig_lib") ! return os.path.abspath(r"swig\swig.exe") ! ! def swig_sources (self, sources): ! new_sources = [] ! swig_sources = [] ! swig_targets = {} ! # XXX this drops generated C/C++ files into the source tree, which ! # is fine for developers who want to distribute the generated ! # source -- but there should be an option to put SWIG output in ! # the temp dir. ! target_ext = '.cpp' ! for source in sources: ! (base, ext) = os.path.splitext(source) ! if ext == ".i": # SWIG interface file ! # Seems the files SWIG creates are not compiled separately, ! # they are #included somewhere else. So we don't include ! # the generated wrapper in the new_sources list. ! swig_sources.append(source) ! # and win32all has it's own naming convention for the wrappers: ! swig_targets[source] = base + 'module_win32' + target_ext else: ! new_sources.append(source) ! if not swig_sources: ! return new_sources ! ! swig = self.find_swig() ! swig_cmd = [swig, "-python"] ! if self.swig_cpp: ! swig_cmd.append("-c++") ! ! for source in swig_sources: ! target = swig_targets[source] ! log.info("swigging %s to %s", source, target) ! self.spawn(swig_cmd + ["-o", target, source]) ! ! return new_sources ! ! ################################################################ ! ! pywintypes = WinExt('pywintypes', ! dsp_file = r"win32\PyWinTypes.dsp", ! extra_compile_args = ['-DBUILD_PYWINTYPES'] ! ) ! ! pythoncom = WinExt('pythoncom', ! dsp_file=r"com\win32com.dsp", ! export_symbol_file = 'com/win32com/src/PythonCOM.def', ! extra_compile_args = ['-DBUILD_PYTHONCOM'], ! ) ! ! win32api = WinExt('win32api', ! dsp_file = r"win32\win32api.dsp") ! ! win32file = WinExt('win32file', ! dsp_file = r"win32\win32file.dsp") ! ! win32event = WinExt('win32event', ! dsp_file = r"win32\win32event.dsp") ! ! ################################################################ setup(name="PyWinTypes", *************** *** 185,193 **** license="???", ! cmdclass = { 'install_lib': my_install_lib, 'build_ext': my_build_ext, }, ! ext_modules = [pywintypes, pythoncom], ## packages=['win32', --- 224,232 ---- license="???", ! cmdclass = { #'install_lib': my_install_lib, 'build_ext': my_build_ext, }, ! ext_modules = [pywintypes, win32api, win32file, win32event, pythoncom], ## packages=['win32', *************** *** 229,231 **** ## ], ) - --- 268,269 ---- |
From: Mark H. <mha...@sk...> - 2003-11-06 11:49:46
|
> Modified Files: > setup_win32all_core.py > Log Message: > There is a chance for distutils, even in the win32all build process! > This encourages me to further work on this script. Yeah, me too :) I've a couple of pending trivial changes - at least that proves I'm serious ;) > The specialized code for pywintypes and pythoncom should be clearer > now, at least to me. Unfortunately, I broke mingw32 support. > > But even before this, I get compilation errors with mingw. An example: > win32/src/PyACL.cpp: In function `BOOL _ReorderACL(_ACL*)': > win32/src/PyACL.cpp:89: `ACCESS_DENIED_OBJECT_ACE_TYPE' > undeclared (first use > this function) > win32/src/PyACL.cpp:89: (Each undeclared identifier is > reported only once for > each function it appears in.) > error: command 'gcc' failed with exit status 1 I've been making lots of changes for that mainwin toolkit recently, and didn't strike that one. > > If someone tells me how this can be fixed I'll happy to also bring > this up to date for mingw. A quick grep shows: WinNT.h:#define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6) So I suggest a simple: #ifndef .... // mingw #define .... If nothing else pops up. I should install mingw, but it is worth noting that we already require some unknown semi-recent version of the "platform sdk" rather than a vanilla MSVC6. However, Roger Upole did most of recent the security stuff, but also himself struck a "platform sdk" version problem trying to build the recent shell changes, so it seems unlikely it is simply that. So buggered if I know :) > swig is now supported (.i sources are parsed out of the dsp files), > and I can at least build > pywintypes, win32api, win32file, win32event, pythoncom. > > Whether they work or not - I cannot currently tell. Woo hoo - check it in :) > install_lib does no longer work, requires rethought: > Some files should be installed in the normal way, others go > into sysdir. No worries - feel free to just hack away on this! And while I am writing a mail - should I check in the "dicts.dat" change to py2exe? For some reason, the hacks etc and bother I went to, to make it work in the first place, bother me enough to want to remove it now! Thanks, Mark. |
From: Thomas H. <th...@py...> - 2003-11-06 13:58:20
|
"Mark Hammond" <mha...@sk...> writes: >> But even before this, I get compilation errors with mingw. An example: >> win32/src/PyACL.cpp: In function `BOOL _ReorderACL(_ACL*)': >> win32/src/PyACL.cpp:89: `ACCESS_DENIED_OBJECT_ACE_TYPE' >> undeclared (first use >> this function) >> win32/src/PyACL.cpp:89: (Each undeclared identifier is >> reported only once for >> each function it appears in.) >> error: command 'gcc' failed with exit status 1 > > I've been making lots of changes for that mainwin toolkit recently, and > didn't strike that one. > >> >> If someone tells me how this can be fixed I'll happy to also bring >> this up to date for mingw. > > A quick grep shows: > > WinNT.h:#define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6) > > So I suggest a simple: > #ifndef .... // mingw > #define .... > > If nothing else pops up. I should install mingw, but it is worth noting > that we already require some unknown semi-recent version of the "platform > sdk" rather than a vanilla MSVC6. However, Roger Upole did most of recent > the security stuff, but also himself struck a "platform sdk" version problem > trying to build the recent shell changes, so it seems unlikely it is simply > that. So buggered if I know :) Well, I have the newest Platform SDK installed (Feb 2003, IIRC). But I assume mingw doesn't use it (at least not without some hints from me). I did try to use the VC6 header files from mingw, but this made things worse (and was probably a bad idea). FWIW, I do not care for mingw myself ('cause I see no reason to use it), and I definitely do *not* want to port win32all to mingw <wink>. For now, I would only like to make sure that the setup script works with mingw, but only if the source is ready for it - but this can also be done by someone else. >> Whether they work or not - I cannot currently tell. > > Woo hoo - check it in :) Already done (as you noted in another email). You can expect a further checkin today, it seems I can build *and install* the win32all subset I use myself. This includes the basic win32 stuff, services, eventlog, but no PythonWin, scintally, ax, or stuff like that. The file locations are different from the win32all standard, but I don't think this hurts. Except, maybe, for pywintypes and pythoncom, which should be in sysdir. But this can be done later, maybe with the post-install script of bdist_wininst. > > No worries - feel free to just hack away on this! > > And while I am writing a mail - should I check in the "dicts.dat" change to > py2exe? For some reason, the hacks etc and bother I went to, to make it > work in the first place, bother me enough to want to remove it now! I have already checked it in, maybe you should double check to make sure it is what you need. Thomas |
From: Mark H. <mha...@sk...> - 2003-11-06 11:50:42
|
Doh! I said "check it in" when replying to a checkin message! So please ignore that :) Mark. > -----Original Message----- > From: pyw...@li... > [mailto:pyw...@li...]On Behalf Of > th...@us... > Sent: Thursday, 6 November 2003 8:10 AM > To: pyw...@li... > Subject: [pywin32-checkins] pywin32 setup_win32all_core.py,1.5,1.6 ... |