diff options
author | Johan Dahlin <johan@src.gnome.org> | 2006-01-09 12:26:46 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2006-01-09 12:26:46 +0000 |
commit | 551a38178f7e66f215980fb01200472c8e6d3cd4 (patch) | |
tree | fbbfd2556f77dc9f64c5c92af76a7dc35930f859 | |
parent | 0b07af909c44f27368a13ecfa94bfda5762e58fb (diff) | |
download | pygobject-551a38178f7e66f215980fb01200472c8e6d3cd4.tar.gz |
Split out PyGObject from PyGTK.
35 files changed, 1693 insertions, 527 deletions
diff --git a/.cvsignore b/.cvsignore new file mode 100644 index 00000000..99c5c272 --- /dev/null +++ b/.cvsignore @@ -0,0 +1,22 @@ +Makefile +Makefile.in +PKG-INFO +aclocal.m4 +autom4te.cache +compile +config.guess +config.h +config.h.in +config.log +config.status +config.sub +configure +depcomp +install-sh +libtool +ltihooks.pyc +ltmain.sh +missing +py-compile +pygobject-2.0.pc +stamp-h1 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 00000000..b4322055 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +Original Author +James Henstridge <james@daa.com.au> + +Current Maintainer +Johan Dahlin <johan@gnome.org> + diff --git a/COPYING b/COPYING new file mode 100644 index 00000000..b1e3f5a2 --- /dev/null +++ b/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 00000000..3a3fdb99 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,38 @@ +2006-01-09 Johan Dahlin <jdahlin@async.com.br> + + * .cvsignore: + * AUTHORS: + * COPYING: + * INSTALL: + * Makefile.am: + * PKG-INFO.in: + * README: + * autogen.sh: + * configure.ac: + * examples/.cvsignore: + * examples/Makefile.am: + * gobject/gobjectmodule.c: (initgobject): + * m4/jhflags.m4: + * m4/python.m4: + * pygobject-2.0.pc.in: + * tests/Makefile.am: + * tests/common.py: + * tests/leak.glade: + * tests/runtests.py: + * tests/test_actiongroup.py: + * tests/test_dialog.py: + * tests/test_gdk.py: + * tests/test_gdkevent.py: + * tests/test_glade.py: + * tests/test_gtype.py: + * tests/test_liststore.py: + * tests/test_radiobutton.py: + * tests/test_signal.py: + * tests/test_subtype.py: + * tests/test_textview.py: + * tests/test_thread.py: + * tests/testhelpermodule.c: (test_type_get_type), + (_wrap_test_g_object_new): + * tests/testmodule.py: + + Split out PyGObject from PyGTK. diff --git a/INSTALL b/INSTALL new file mode 100644 index 00000000..54caf7c1 --- /dev/null +++ b/INSTALL @@ -0,0 +1,229 @@ +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software +Foundation, Inc. + + This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. Run `./configure --help' +for details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=PATH' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, `configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the `--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +`configure' Invocation +====================== + + `configure' recognizes the following options to control how it +operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 00000000..e76146ed --- /dev/null +++ b/Makefile.am @@ -0,0 +1,41 @@ +AUTOMAKE_OPTIONS = 1.7 + +SUBDIRS = gobject . examples tests + +PLATFORM_VERSION = 2.0 + +CLEANFILES = +EXTRA_DIST = \ + MANIFEST.in \ + MAPPING \ + pygobject-$(PLATFORM_VERSION).pc.in \ + PKG-INFO \ + PKG-INFO.in \ + setup.py \ + THREADS +INCLUDES = $(PYTHON_INCLUDES) $(GLIB_CFLAGS) -I$(top_srcdir)/gobject + +# pkg-config files +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = pygobject-$(PLATFORM_VERSION).pc + +# python +pyexec_PYTHON = pygtk.py +pyexec_LTLIBRARIES = +noinst_PYTHON = ltihooks.py + +# linker flags +common_ldflags = -module -avoid-version +if PLATFORM_WIN32 +common_ldflags += -no-undefined +endif + +# install pth file. +install-data-local: + $(mkinstalldirs) $(DESTDIR)$(pythondir) + echo "gtk-$(PLATFORM_VERSION)" > $(DESTDIR)$(pyexecdir)/pygtk.pth +install-exec-local: + $(mkinstalldirs) $(DESTDIR)$(pyexecdir) + echo "gtk-$(PLATFORM_VERSION)" > $(DESTDIR)$(pyexecdir)/pygtk.pth +uninstall-local: + rm -f $(DESTDIR)$(pythondir)/pygtk.pth $(DESTDIR)$(pyexecdir)/pygtk.pth diff --git a/PKG-INFO.in b/PKG-INFO.in new file mode 100644 index 00000000..5f711212 --- /dev/null +++ b/PKG-INFO.in @@ -0,0 +1,22 @@ +Metadata-Version: 1.0 +Name: PyGObject +Version: @VERSION@ +Summary: Python bindings for GObject +Home-page: http://www.pygtk.org/ +Author: James Henstridge +Author-email: james@daa.com.au +Maintainer: Johan Dahlin +Maintainer-email: johan@gnome.org +License: GNU LGPL +Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/@PYGOBJECT_MAJOR_VERSION@.@PYGOBJECT_MINOR_VERSION@/pygobject-@VERSION@.tar.gz +Description: Python bindings for GObject +Platform: POSIX, Windows +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Win32 (MS Windows) +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) +Classifier: Operating System :: POSIX +Classifier: Operating System :: Microsoft :: Windows +Classifier: Programming Language :: C +Classifier: Programming Language :: Python +Classifier: Topic :: Software Development :: Libraries :: Python Modules @@ -0,0 +1,93 @@ +PyGTK +===== +Original author: James Henstridge <james@daa.com.au> +Current maintainer: Johan Dahlin <johan@gnome.org> + +This archive contains bindings for the GObject, to be used in Python +It is a fairly complete set of bindings, it's already rather useful, +and is usable to write moderately complex programs. (see the +examples directory for some examples of the simpler programs you could +write). + +If you have any enhancements or bug reports, please file them in +bugzilla at: + http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject + +If you have a patch, file the bug first and then use the "create new +attachment" link on the bug's info page. My preferred format for +patches is unified diff format (ie. diff -u). Please don't send me +diffs which don't have any context, as these make it very difficult to +see what the patch does. + +New Versions +============ + +New versions of this package can be found at: + http://ftp.gnome.org/pub/GNOME/sources/pygobject/ + + +Mailing list +============ + +pygobject share mailing list with pygtk. You can subscribe to it through +the web interface: + http://www.daa.com.au/mailman/listinfo/pygtk + + +Requirements +============ + * C compiler (GCC and MSVC supported) + * Python 2.3.5 or higher + * Glib 2.8.0 or higher + +Copyright Information +===================== + +This software is covered by the GNU Lesser General Public Licence +(version 2.1, or if you choose, a later version). Basically just don't +say you wrote bits you didn't. + +Compilation +=========== + +PyGTK uses the standard autotools for the build infrastructure. To +build, it should be as simple as running: + + $ ./configure --prefix=<prefix where python is installed> + $ make + $ make install + +If your Python interpreter isn't in the path, or is not called +"python", you can set the PYTHON environment variable to the full path +of the interpreter: + + $ PYTHON=/prefix/bin/python + $ export PYTHON + +If configure can't find GTK+, you may need to set the PKG_CONFIG_PATH +environment variable to help it find the libraries. + +The "make install" target will generate normal and optimised bytecode +for all the .py files. + +Note. If you're installing to another prefix than the one where python +is installed you'll need to set the PYTHONPATH variable to the +$prefix/lib/pythonX.Y/site-packages directory created by +the PyGTK installation. + +Tests +===== + +After having compiled and installed pygtk, you may want to test them. +There are a number of example programs available in the examples/ +subdirectory. + + +Getting Help +============ + +If you have questions about programming with PyGObject, you might want to +send a message to the mailing list (information on subscribing is +above). Alternatively, your question may be answered in the PyGTK FAQ: + + http://www.async.com.br/faq/pygtk/?req=index diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 00000000..90ebfc12 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,476 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +REQUIRED_AUTOMAKE_VERSION=1.8 + +PKG_NAME="PyGObject" +ACLOCAL_FLAGS="-I `pwd`/m4 $ACLOCAL_FLAGS" + +#name of package +PKG_NAME=${PKG_NAME:-Package} +srcdir=${srcdir:-.} + +# default version requirements ... +REQUIRED_AUTOCONF_VERSION=${REQUIRED_AUTOCONF_VERSION:-2.53} +REQUIRED_AUTOMAKE_VERSION=${REQUIRED_AUTOMAKE_VERSION:-1.4} +REQUIRED_LIBTOOL_VERSION=${REQUIRED_LIBTOOL_VERSION:-1.4.3} +REQUIRED_GETTEXT_VERSION=${REQUIRED_GETTEXT_VERSION:-0.10.40} +REQUIRED_GLIB_GETTEXT_VERSION=${REQUIRED_GLIB_GETTEXT_VERSION:-2.2.0} +REQUIRED_INTLTOOL_VERSION=${REQUIRED_INTLTOOL_VERSION:-0.25} +REQUIRED_PKG_CONFIG_VERSION=${REQUIRED_PKG_CONFIG_VERSION:-0.14.0} +REQUIRED_GTK_DOC_VERSION=${REQUIRED_GTK_DOC_VERSION:-1.0} +REQUIRED_DOC_COMMON_VERSION=${REQUIRED_DOC_COMMON_VERSION:-2.3.0} +REQUIRED_GNOME_DOC_UTILS_VERSION=${REQUIRED_GNOME_DOC_UTILS_VERSION:-0.3.2} + +# a list of required m4 macros. Package can set an initial value +REQUIRED_M4MACROS=${REQUIRED_M4MACROS:-} +FORBIDDEN_M4MACROS=${FORBIDDEN_M4MACROS:-} + +# Not all echo versions allow -n, so we check what is possible. This test is +# based on the one in autoconf. +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ;; + *c*,* ) ECHO_N=-n ;; + *) ECHO_N= ;; +esac + +# some terminal codes ... +boldface="`tput bold 2>/dev/null`" +normal="`tput sgr0 2>/dev/null`" +printbold() { + echo $ECHO_N "$boldface" + echo "$@" + echo $ECHO_N "$normal" +} +printerr() { + echo "$@" >&2 +} + +# Usage: +# compare_versions MIN_VERSION ACTUAL_VERSION +# returns true if ACTUAL_VERSION >= MIN_VERSION +compare_versions() { + ch_min_version=$1 + ch_actual_version=$2 + ch_status=0 + IFS="${IFS= }"; ch_save_IFS="$IFS"; IFS="." + set $ch_actual_version + for ch_min in $ch_min_version; do + ch_cur=`echo $1 | sed 's/[^0-9].*$//'`; shift # remove letter suffixes + if [ -z "$ch_min" ]; then break; fi + if [ -z "$ch_cur" ]; then ch_status=1; break; fi + if [ $ch_cur -gt $ch_min ]; then break; fi + if [ $ch_cur -lt $ch_min ]; then ch_status=1; break; fi + done + IFS="$ch_save_IFS" + return $ch_status +} + +# Usage: +# version_check PACKAGE VARIABLE CHECKPROGS MIN_VERSION SOURCE +# checks to see if the package is available +version_check() { + vc_package=$1 + vc_variable=$2 + vc_checkprogs=$3 + vc_min_version=$4 + vc_source=$5 + vc_status=1 + + vc_checkprog=`eval echo "\\$$vc_variable"` + if [ -n "$vc_checkprog" ]; then + printbold "using $vc_checkprog for $vc_package" + return 0 + fi + + if test "x$vc_package" = "xautomake" -a "x$vc_min_version" = "x1.4"; then + vc_comparator="=" + else + vc_comparator=">=" + fi + printbold "checking for $vc_package $vc_comparator $vc_min_version..." + for vc_checkprog in $vc_checkprogs; do + echo $ECHO_N " testing $vc_checkprog... " + if $vc_checkprog --version < /dev/null > /dev/null 2>&1; then + vc_actual_version=`$vc_checkprog --version | head -n 1 | \ + sed 's/^.*[ ]\([0-9.]*[a-z]*\).*$/\1/'` + if compare_versions $vc_min_version $vc_actual_version; then + echo "found $vc_actual_version" + # set variables + eval "$vc_variable=$vc_checkprog; \ + ${vc_variable}_VERSION=$vc_actual_version" + vc_status=0 + break + else + echo "too old (found version $vc_actual_version)" + fi + else + echo "not found." + fi + done + if [ "$vc_status" != 0 ]; then + printerr "***Error***: You must have $vc_package $vc_comparator $vc_min_version installed" + printerr " to build $PKG_NAME. Download the appropriate package for" + printerr " from your distribution or get the source tarball at" + printerr " $vc_source" + printerr + fi + return $vc_status +} + +# Usage: +# require_m4macro filename.m4 +# adds filename.m4 to the list of required macros +require_m4macro() { + case "$REQUIRED_M4MACROS" in + $1\ * | *\ $1\ * | *\ $1) ;; + *) REQUIRED_M4MACROS="$REQUIRED_M4MACROS $1" ;; + esac +} + +forbid_m4macro() { + case "$FORBIDDEN_M4MACROS" in + $1\ * | *\ $1\ * | *\ $1) ;; + *) FORBIDDEN_M4MACROS="$FORBIDDEN_M4MACROS $1" ;; + esac +} + +# Usage: +# add_to_cm_macrodirs dirname +# Adds the dir to $cm_macrodirs, if it's not there yet. +add_to_cm_macrodirs() { + case $cm_macrodirs in + "$1 "* | *" $1 "* | *" $1") ;; + *) cm_macrodirs="$cm_macrodirs $1";; + esac +} + +# Usage: +# check_m4macros +# Checks that all the requested macro files are in the aclocal macro path +# Uses REQUIRED_M4MACROS and ACLOCAL variables. +check_m4macros() { + # construct list of macro directories + cm_macrodirs=`$ACLOCAL --print-ac-dir` + # aclocal also searches a version specific dir, eg. /usr/share/aclocal-1.9 + # but it contains only Automake's own macros, so we can ignore it. + + # Read the dirlist file, supported by Automake >= 1.7. + if compare_versions 1.7 $AUTOMAKE_VERSION && [ -s $cm_macrodirs/dirlist ]; then + cm_dirlist=`sed 's/[ ]*#.*//;/^$/d' $cm_macrodirs/dirlist` + if [ -n "$cm_dirlist" ] ; then + for cm_dir in $cm_dirlist; do + if [ -d $cm_dir ]; then + add_to_cm_macrodirs $cm_dir + fi + done + fi + fi + + # Parse $ACLOCAL_FLAGS + set - $ACLOCAL_FLAGS + while [ $# -gt 0 ]; do + if [ "$1" = "-I" ]; then + add_to_cm_macrodirs "$2" + shift + fi + shift + done + + cm_status=0 + if [ -n "$REQUIRED_M4MACROS" ]; then + printbold "Checking for required M4 macros..." + # check that each macro file is in one of the macro dirs + for cm_macro in $REQUIRED_M4MACROS; do + cm_macrofound=false + for cm_dir in $cm_macrodirs; do + if [ -f "$cm_dir/$cm_macro" ]; then + cm_macrofound=true + break + fi + # The macro dir in Cygwin environments may contain a file + # called dirlist containing other directories to look in. + if [ -f "$cm_dir/dirlist" ]; then + for cm_otherdir in `cat $cm_dir/dirlist`; do + if [ -f "$cm_otherdir/$cm_macro" ]; then + cm_macrofound=true + break + fi + done + fi + done + if $cm_macrofound; then + : + else + printerr " $cm_macro not found" + cm_status=1 + fi + done + fi + if [ -n "$FORBIDDEN_M4MACROS" ]; then + printbold "Checking for forbidden M4 macros..." + # check that each macro file is in one of the macro dirs + for cm_macro in $FORBIDDEN_M4MACROS; do + cm_macrofound=false + for cm_dir in $cm_macrodirs; do + if [ -f "$cm_dir/$cm_macro" ]; then + cm_macrofound=true + break + fi + done + if $cm_macrofound; then + printerr " $cm_macro found (should be cleared from macros dir)" + cm_status=1 + fi + done + fi + if [ "$cm_status" != 0 ]; then + printerr "***Error***: some autoconf macros required to build $PKG_NAME" + printerr " were not found in your aclocal path, or some forbidden" + printerr " macros were found. Perhaps you need to adjust your" + printerr " ACLOCAL_FLAGS?" + printerr + fi + return $cm_status +} + +# try to catch the case where the macros2/ directory hasn't been cleared out. +forbid_m4macro gnome-cxx-check.m4 + +want_libtool=false +want_gettext=false +want_glib_gettext=false +want_intltool=false +want_pkg_config=false +want_gtk_doc=false +want_gnome_doc_utils=false + +configure_files="`find $srcdir -name '{arch}' -prune -o -name configure.ac -print -o -name configure.in -print`" +for configure_ac in $configure_files; do + if grep "^A[CM]_PROG_LIBTOOL" $configure_ac >/dev/null || + grep "^LT_INIT" $configure_ac >/dev/null; then + want_libtool=true + fi + if grep "^AM_GNU_GETTEXT" $configure_ac >/dev/null; then + want_gettext=true + fi + if grep "^AM_GLIB_GNU_GETTEXT" $configure_ac >/dev/null; then + want_glib_gettext=true + fi + if grep "^AC_PROG_INTLTOOL" $configure_ac >/dev/null || + grep "^IT_PROG_INTLTOOL" $configure_ac >/dev/null; then + want_intltool=true + fi + if grep "^PKG_CHECK_MODULES" $configure_ac >/dev/null; then + want_pkg_config=true + fi + if grep "^GTK_DOC_CHECK" $configure_ac >/dev/null; then + want_gtk_doc=true + fi + if grep "^GNOME_DOC_INIT" $configure_ac >/dev/null; then + want_gnome_doc_utils=true + fi + + # check to make sure gnome-common macros can be found ... + if grep "^GNOME_COMMON_INIT" $configure_ac >/dev/null || + grep "^GNOME_DEBUG_CHECK" $configure_ac >/dev/null || + grep "^GNOME_MAINTAINER_MODE_DEFINES" $configure_ac >/dev/null; then + require_m4macro gnome-common.m4 + fi + if grep "^GNOME_COMPILE_WARNINGS" $configure_ac >/dev/null || + grep "^GNOME_CXX_WARNINGS" $configure_ac >/dev/null; then + require_m4macro gnome-compiler-flags.m4 + fi +done + +DIE=0 + +#tell Mandrake autoconf wrapper we want autoconf 2.5x, not 2.13 +WANT_AUTOCONF_2_5=1 +export WANT_AUTOCONF_2_5 +version_check autoconf AUTOCONF 'autoconf2.50 autoconf autoconf-2.53' $REQUIRED_AUTOCONF_VERSION \ + "http://ftp.gnu.org/pub/gnu/autoconf/autoconf-$REQUIRED_AUTOCONF_VERSION.tar.gz" || DIE=1 +AUTOHEADER=`echo $AUTOCONF | sed s/autoconf/autoheader/` + +case $REQUIRED_AUTOMAKE_VERSION in + 1.4*) automake_progs="automake-1.4" ;; + 1.5*) automake_progs="automake-1.5 automake-1.6 automake-1.7 automake-1.8 automake-1.9" ;; + 1.6*) automake_progs="automake-1.6 automake-1.7 automake-1.8 automake-1.9" ;; + 1.7*) automake_progs="automake-1.7 automake-1.8 automake-1.9" ;; + 1.8*) automake_progs="automake-1.8 automake-1.9" ;; + 1.9*) automake_progs="automake-1.9" ;; +esac +version_check automake AUTOMAKE "$automake_progs" $REQUIRED_AUTOMAKE_VERSION \ + "http://ftp.gnu.org/pub/gnu/automake/automake-$REQUIRED_AUTOMAKE_VERSION.tar.gz" || DIE=1 +ACLOCAL=`echo $AUTOMAKE | sed s/automake/aclocal/` + +if $want_libtool; then + version_check libtool LIBTOOLIZE libtoolize $REQUIRED_LIBTOOL_VERSION \ + "http://ftp.gnu.org/pub/gnu/libtool/libtool-$REQUIRED_LIBTOOL_VERSION.tar.gz" || DIE=1 + require_m4macro libtool.m4 +fi + +if $want_gettext; then + version_check gettext GETTEXTIZE gettextize $REQUIRED_GETTEXT_VERSION \ + "http://ftp.gnu.org/pub/gnu/gettext/gettext-$REQUIRED_GETTEXT_VERSION.tar.gz" || DIE=1 + require_m4macro gettext.m4 +fi + +if $want_glib_gettext; then + version_check glib-gettext GLIB_GETTEXTIZE glib-gettextize $REQUIRED_GLIB_GETTEXT_VERSION \ + "ftp://ftp.gtk.org/pub/gtk/v2.2/glib-$REQUIRED_GLIB_GETTEXT_VERSION.tar.gz" || DIE=1 + require_m4macro glib-gettext.m4 +fi + +if $want_intltool; then + version_check intltool INTLTOOLIZE intltoolize $REQUIRED_INTLTOOL_VERSION \ + "http://ftp.gnome.org/pub/GNOME/sources/intltool/" || DIE=1 + require_m4macro intltool.m4 +fi + +if $want_pkg_config; then + version_check pkg-config PKG_CONFIG pkg-config $REQUIRED_PKG_CONFIG_VERSION \ + "'http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-$REQUIRED_PKG_CONFIG_VERSION.tar.gz" || DIE=1 + require_m4macro pkg.m4 +fi + +if $want_gtk_doc; then + version_check gtk-doc GTKDOCIZE gtkdocize $REQUIRED_GTK_DOC_VERSION \ + "http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/" || DIE=1 + require_m4macro gtk-doc.m4 +fi + +if $want_gnome_doc_utils; then + version_check gnome-doc-utils GNOME_DOC_PREPARE gnome-doc-prepare $REQUIRED_GNOME_DOC_UTILS_VERSION \ + "http://ftp.gnome.org/pub/GNOME/sources/gnome-doc-utils/" || DIE=1 +fi + +if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then + version_check gnome-common DOC_COMMON gnome-doc-common \ + $REQUIRED_DOC_COMMON_VERSION " " || DIE=1 +fi + +check_m4macros || DIE=1 + +if [ "$DIE" -eq 1 ]; then + exit 1 +fi + +if [ "$#" = 0 ]; then + printerr "**Warning**: I am going to run \`configure' with no arguments." + printerr "If you wish to pass any to it, please specify them on the" + printerr \`$0\'" command line." + printerr +fi + +topdir=`pwd` +for configure_ac in $configure_files; do + dirname=`dirname $configure_ac` + basename=`basename $configure_ac` + if [ -f $dirname/NO-AUTO-GEN ]; then + echo skipping $dirname -- flagged as no auto-gen + elif [ ! -w $dirname ]; then + echo skipping $dirname -- directory is read only + else + printbold "Processing $configure_ac" + cd $dirname + + # Note that the order these tools are called should match what + # autoconf's "autoupdate" package does. See bug 138584 for + # details. + + # programs that might install new macros get run before aclocal + if grep "^A[CM]_PROG_LIBTOOL" $basename >/dev/null || + grep "^LT_INIT" $basename >/dev/null; then + printbold "Running $LIBTOOLIZE..." + $LIBTOOLIZE --force --copy || exit 1 + fi + + if grep "^AM_GLIB_GNU_GETTEXT" $basename >/dev/null; then + printbold "Running $GLIB_GETTEXTIZE... Ignore non-fatal messages." + echo "no" | $GLIB_GETTEXTIZE --force --copy || exit 1 + elif grep "^AM_GNU_GETTEXT" $basename >/dev/null; then + if grep "^AM_GNU_GETTEXT_VERSION" $basename > /dev/null; then + printbold "Running autopoint..." + autopoint --force || exit 1 + else + printbold "Running $GETTEXTIZE... Ignore non-fatal messages." + echo "no" | $GETTEXTIZE --force --copy || exit 1 + fi + fi + + if grep "^AC_PROG_INTLTOOL" $basename >/dev/null || + grep "^IT_PROG_INTLTOOL" $basename >/dev/null; then + printbold "Running $INTLTOOLIZE..." + $INTLTOOLIZE --force --copy --automake || exit 1 + fi + if grep "^GTK_DOC_CHECK" $basename >/dev/null; then + printbold "Running $GTKDOCIZE..." + $GTKDOCIZE --copy || exit 1 + fi + + if [ "x$USE_COMMON_DOC_BUILD" = "xyes" ]; then + printbold "Running gnome-doc-common..." + gnome-doc-common --copy || exit 1 + fi + if grep "^GNOME_DOC_INIT" $basename >/dev/null; then + printbold "Running $GNOME_DOC_PREPARE..." + $GNOME_DOC_PREPARE --force --copy || exit 1 + fi + + # Now run aclocal to pull in any additional macros needed + + # if the AC_CONFIG_MACRO_DIR() macro is used, pass that + # directory to aclocal. + m4dir=`cat "$basename" | grep '^AC_CONFIG_MACRO_DIR' | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q` + if [ -n "$m4dir" ]; then + m4dir="-I $m4dir" + fi + printbold "Running $ACLOCAL..." + $ACLOCAL $m4dir $ACLOCAL_FLAGS || exit 1 + + if grep "GNOME_AUTOGEN_OBSOLETE" aclocal.m4 >/dev/null; then + printerr "*** obsolete gnome macros were used in $configure_ac" + fi + + # Now that all the macros are sorted, run autoconf and autoheader ... + printbold "Running $AUTOCONF..." + $AUTOCONF || exit 1 + if grep "^A[CM]_CONFIG_HEADER" $basename >/dev/null; then + printbold "Running $AUTOHEADER..." + $AUTOHEADER || exit 1 + # this prevents automake from thinking config.h.in is out of + # date, since autoheader doesn't touch the file if it doesn't + # change. + test -f config.h.in && touch config.h.in + fi + + # Finally, run automake to create the makefiles ... + printbold "Running $AUTOMAKE..." + cp -pf COPYING COPYING.autogen_bak + cp -pf INSTALL INSTALL.autogen_bak + if [ $REQUIRED_AUTOMAKE_VERSION != 1.4 ]; then + $AUTOMAKE --gnu --add-missing --force --copy || exit 1 + else + $AUTOMAKE --gnu --add-missing --copy || exit 1 + fi + cmp COPYING COPYING.autogen_bak || cp -pf COPYING.autogen_bak COPYING + cmp INSTALL INSTALL.autogen_bak || cp -pf INSTALL.autogen_bak INSTALL + rm -f COPYING.autogen_bak INSTALL.autogen_bak + + cd "$topdir" + fi +done + +conf_flags="--enable-maintainer-mode" + +if test x$NOCONFIGURE = x; then + printbold Running $srcdir/configure $conf_flags "$@" ... + $srcdir/configure $conf_flags "$@" \ + && echo Now type \`make\' to compile $PKG_NAME || exit 1 +else + echo Skipping configure process. +fi diff --git a/configure.ac b/configure.ac new file mode 100644 index 00000000..ed60c30b --- /dev/null +++ b/configure.ac @@ -0,0 +1,109 @@ +-*- mode: m4 -*- +AC_PREREQ(2.52) + +dnl the pygobject version number +m4_define(pygobject_major_version, 2) +m4_define(pygobject_minor_version, 9) +m4_define(pygobject_micro_version, 0) +m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version) + +dnl versions of packages we require ... +m4_define(glib_required_version, 2.8.0) + +AC_INIT(pygobject, pygobject_version, + [http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject]) +AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .") + +AC_DEFINE(PYGOBJECT_MAJOR_VERSION, pygobject_major_version, [pygobject major version]) +AC_SUBST(PYGOBJECT_MAJOR_VERSION, pygobject_major_version) +AC_DEFINE(PYGOBJECT_MINOR_VERSION, pygobject_minor_version, [pygobject minor version]) +AC_SUBST(PYGOBJECT_MINOR_VERSION, pygobject_minor_version) +AC_DEFINE(PYGOBJECT_MICRO_VERSION, pygobject_micro_version, [pygobject micro version]) +AC_SUBST(PYGOBJECT_MICRO_VERSION, pygobject_micro_version) + +AC_CONFIG_SRCDIR([gobject/gobjectmodule.c]) +AM_CONFIG_HEADER(config.h) + +AM_INIT_AUTOMAKE + +dnl put the ACLOCAL flags in the makefile +ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + +AC_CANONICAL_BUILD +AC_CANONICAL_HOST +AC_MSG_CHECKING([for some Win32 platform]) +case "$host" in + *-*-mingw*|*-*-cygwin*) + platform_win32=yes + ;; + *) + platform_win32=no + ;; +esac +AC_MSG_RESULT([$platform_win32]) +AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes") + +AC_MSG_CHECKING([for native Win32]) +case "$host" in + *-*-mingw*) + os_win32=yes + ;; + *) + os_win32=no + ;; +esac +AC_MSG_RESULT([$os_win32]) +AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") + +AC_DISABLE_STATIC +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL + +AM_PATH_PYTHON(2.3.5) + +AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)]) + +AC_ARG_ENABLE(thread, + AC_HELP_STRING([--disable-thread], [Disable pygobject threading support]),, + enable_thread=yes) + +AM_CHECK_PYMOD(thread,,,enable_thread=no) + +AC_MSG_CHECKING(whether to enable threading in pygobject) +if test "x$enable_thread" != xno; then + extra_mods=gthread + THREADING_CFLAGS= + AC_MSG_RESULT(yes) +else + extra_mods= + THREADING_CFLAGS="-DDISABLE_THREADING" + AC_MSG_RESULT(no) +fi +AC_SUBST(THREADING_CFLAGS) +CPPFLAGS="${CPPFLAGS} $THREADING_CFLAGS" + +dnl get rid of the -export-dynamic stuff from the configure flags ... +export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh` + +dnl glib +AM_PATH_GLIB_2_0(glib_required_version,,[AC_MSG_ERROR(maybe you want the pygobject-2-4 branch?)],gobject $extra_mods) +if test -n "$export_dynamic"; then + GLIB_LIBS=`echo $GLIB_LIBS | sed -e "s/$export_dynamic//"` +fi + +pygobject_CODEGEN_DEFINES="" +AC_SUBST([pygobject_CODEGEN_DEFINES]) + +dnl add required cflags ... +JH_ADD_CFLAG([-Wall]) +JH_ADD_CFLAG([-std=c9x]) +JH_ADD_CFLAG([-fno-strict-aliasing]) + +AC_CONFIG_FILES( + Makefile + pygobject-2.0.pc + gobject/Makefile + examples/Makefile + tests/Makefile + PKG-INFO) +AC_OUTPUT diff --git a/examples/.cvsignore b/examples/.cvsignore new file mode 100644 index 00000000..282522db --- /dev/null +++ b/examples/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 00000000..0db71288 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = properties.py signal.py diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c index 917a2b26..06572cdb 100644 --- a/gobject/gobjectmodule.c +++ b/gobject/gobjectmodule.c @@ -2821,9 +2821,13 @@ initgobject(void) PyDict_SetItemString(d, "glib_version", tuple); Py_DECREF(tuple); - /* pygtk version */ - tuple = Py_BuildValue ("(iii)", PYGTK_MAJOR_VERSION, PYGTK_MINOR_VERSION, - PYGTK_MICRO_VERSION); + /* pygobject version */ + tuple = Py_BuildValue ("(iii)", + PYGOBJECT_MAJOR_VERSION, + PYGOBJECT_MINOR_VERSION, + PYGOBJECT_MICRO_VERSION); + PyDict_SetItemString(d, "pygobject_version", tuple); + /* backwards compatibility */ PyDict_SetItemString(d, "pygtk_version", tuple); Py_DECREF(tuple); diff --git a/m4/jhflags.m4 b/m4/jhflags.m4 new file mode 100644 index 00000000..222e4b09 --- /dev/null +++ b/m4/jhflags.m4 @@ -0,0 +1,21 @@ +dnl +dnl JH_ADD_CFLAG(FLAG) +dnl checks whether the C compiler supports the given flag, and if so, adds +dnl it to $CFLAGS. If the flag is already present in the list, then the +dnl check is not performed. +AC_DEFUN([JH_ADD_CFLAG], +[ +case " $CFLAGS " in +*@<:@\ \ @:>@$1@<:@\ \ @:>@*) + ;; +*) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + AC_MSG_CHECKING([whether [$]CC understands $1]) + AC_TRY_COMPILE([], [], [jh_has_option=yes], [jh_has_option=no]) + AC_MSG_RESULT($jh_has_option) + if test $jh_has_option = no; then + CFLAGS="$save_CFLAGS" + fi + ;; +esac]) diff --git a/m4/python.m4 b/m4/python.m4 new file mode 100644 index 00000000..a1396df7 --- /dev/null +++ b/m4/python.m4 @@ -0,0 +1,62 @@ +## this one is commonly used with AM_PATH_PYTHONDIR ... +dnl AM_CHECK_PYMOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]]) +dnl Check if a module containing a given symbol is visible to python. +AC_DEFUN(AM_CHECK_PYMOD, +[AC_REQUIRE([AM_PATH_PYTHON]) +py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING(for ifelse([$2],[],,[$2 in ])python module $1) +AC_CACHE_VAL(py_cv_mod_$py_mod_var, [ +ifelse([$2],[], [prog=" +import sys +try: + import $1 +except ImportError: + sys.exit(1) +except: + sys.exit(0) +sys.exit(0)"], [prog=" +import $1 +$1.$2"]) +if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC + then + eval "py_cv_mod_$py_mod_var=yes" + else + eval "py_cv_mod_$py_mod_var=no" + fi +]) +py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"` +if test "x$py_val" != xno; then + AC_MSG_RESULT(yes) + ifelse([$3], [],, [$3 +])dnl +else + AC_MSG_RESULT(no) + ifelse([$4], [],, [$4 +])dnl +fi +]) + +dnl a macro to check for ability to create python extensions +dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) +dnl function also defines PYTHON_INCLUDES +AC_DEFUN([AM_CHECK_PYTHON_HEADERS], +[AC_REQUIRE([AM_PATH_PYTHON]) +AC_MSG_CHECKING(for headers required to compile python extensions) +dnl deduce PYTHON_INCLUDES +py_prefix=`$PYTHON -c "import sys; print sys.prefix"` +py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +if test "$py_prefix" != "$py_exec_prefix"; then + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" +fi +AC_SUBST(PYTHON_INCLUDES) +dnl check if the headers exist: +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" +AC_TRY_CPP([#include <Python.h>],dnl +[AC_MSG_RESULT(found) +$1],dnl +[AC_MSG_RESULT(not found) +$2]) +CPPFLAGS="$save_CPPFLAGS" +]) diff --git a/pygobject-2.0.pc.in b/pygobject-2.0.pc.in new file mode 100644 index 00000000..88f239cc --- /dev/null +++ b/pygobject-2.0.pc.in @@ -0,0 +1,16 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +datarootdir=@datarootdir@ +datadir=@datadir@ + +# you can use the --variable=pygtkincludedir argument to +# pkg-config to get this value. You might want to use this to +# install additional headers. +pygtkincludedir=${includedir}/pygtk-2.0 + +Name: PyGObject +Description: Python bindings for GObject +Requires: gobject-2.0 +Version: @VERSION@ +Cflags: -I${pygtkincludedir} diff --git a/tests/Makefile.am b/tests/Makefile.am index 15ee4f04..c13ca726 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,12 +1,9 @@ INCLUDES = \ $(PYTHON_INCLUDES) \ $(GLIB_CFLAGS) \ - $(PANGO_CFLAGS) \ - $(ATK_CFLAGS) \ - $(GTK_CFLAGS) \ -I$(top_srcdir)/gobject -EXTRA_DIST = $(tests) common.py runtests.py test-thread.h test-unknown.h testmodule.py leak.glade +EXTRA_DIST = $(tests) common.py runtests.py test-thread.h test-unknown.h noinst_LTLIBRARIES = testhelper.la linked_LIBS = testhelper.la @@ -19,35 +16,19 @@ testhelper_la_SOURCES = \ test-unknown.c tests = \ - test_glade.py \ - test_conversion.py \ - test_dialog.py \ - test_enum.py \ - test_gdk.py \ test_gtype.py \ test_mainloop.py \ - test_radiobutton.py \ test_properties.py \ test_signal.py \ test_subprocess.py \ test_subtype.py \ - test_gdkevent.py \ test_unknown.py \ - test_textview.py \ test_source.py # This is a hack to make sure a shared library is built testhelper.la: $(testhelper_la_OBJECTS) $(testhelper_la_DEPENDENCIES) $(LINK) -rpath $(pkgpyexecdir) $(testhelper_la_LDFLAGS) $(testhelper_la_OBJECTS) $(testhelper_la_LIBADD) $(LIBS) -check-local: $(top_srcdir)/gtk/__init__.py - @if test "$(top_builddir)" != "$(top_srcdir)"; then \ - cp $(top_srcdir)/gtk/__init__.py $(top_builddir)/gtk/__init__.py; \ - cp $(top_srcdir)/gtk/keysyms.py $(top_builddir)/gtk/keysyms.py; \ - fi +check-local: @$(PYTHON) $(srcdir)/runtests.py $(top_builddir) $(top_srcdir) - @if test "$(top_builddir)" != "$(top_srcdir)"; then \ - rm -f $(top_builddir)/gtk/__init__.py*; \ - rm -f $(top_builddir)/gtk/keysyms.py*; \ - fi @rm -fr *.pyc diff --git a/tests/common.py b/tests/common.py index e9704611..627e2811 100644 --- a/tests/common.py +++ b/tests/common.py @@ -7,27 +7,16 @@ def importModules(buildDir, srcDir): # ltihooks sys.path.insert(0, srcDir) - # atk, pango - sys.path.insert(0, buildDir) + import ltihooks + sys.path.remove(srcDir) + # gobject sys.path.insert(0, os.path.join(buildDir, 'gobject')) - # _gtk, keysyms, glade - sys.path.insert(0, os.path.join(buildDir, 'gtk')) # testhelper sys.path.insert(0, os.path.join(buildDir, 'tests')) sys.argv.append('--g-fatal-warnings') - import ltihooks gobject = importModule('gobject', buildDir, 'gobject/gobject.la') - atk = importModule('atk', buildDir) - pango = importModule('pango', buildDir) - gtk = importModule('gtk', buildDir, 'gtk') - gdk = importModule('gtk.gdk', buildDir, '_gdk.la') - try: - glade = importModule('gtk.glade', buildDir, 'glade.la') - except ImportError: - glade = None - testhelper = importModule('testhelper', '.') ltihooks.uninstall() @@ -52,8 +41,9 @@ def importModule(module, directory, name=None): try: obj = __import__(module, {}, {}, fromlist) - except ImportError: + except ImportError, e: print 'WARNING: %s could not be imported' % origName + print e return if hasattr(obj, '__file__'): diff --git a/tests/leak.glade b/tests/leak.glade deleted file mode 100644 index 50161c0a..00000000 --- a/tests/leak.glade +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="window1"> - <property name="border_width">25</property> - <property name="visible">True</property> - <property name="title" translatable="yes">window1</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - <signal name="destroy" handler="on_window1_destroy" last_modification_time="Sun, 25 Sep 2005 14:22:00 GMT"/> - - <child> - <placeholder/> - </child> -</widget> - -</glade-interface> diff --git a/tests/runtests.py b/tests/runtests.py index 42f6a0c7..3ae71850 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -21,7 +21,7 @@ else: common.importModules(buildDir=buildDir, srcDir=srcDir) -SKIP_FILES = ['common', 'runtests', 'testmodule'] +SKIP_FILES = ['common', 'runtests'] dir = os.path.split(os.path.abspath(__file__))[0] os.chdir(dir) diff --git a/tests/test_actiongroup.py b/tests/test_actiongroup.py deleted file mode 100644 index d7ceed1d..00000000 --- a/tests/test_actiongroup.py +++ /dev/null @@ -1,127 +0,0 @@ -# Test for Bug #162874 - -import unittest -import sys -import gc - -from common import gtk, gobject - - -class ActionGroupTest(unittest.TestCase): - ui0 = '''<ui> - <menubar name="MenuBar"> - <menu action="File"> - <menuitem action="Quit"/> - </menu> - <menu action="Sound"> - <menuitem action="Mute"/> - </menu> - <menu action="RadioBand"> - <menuitem action="AM"/> - <menuitem action="FM"/> - <menuitem action="SSB"/> - </menu> - </menubar> - <toolbar name="Toolbar"> - <toolitem action="Quit"/> - <separator/> - <toolitem action="Mute"/> - <separator name="sep1"/> - <placeholder name="RadioBandItems"> - <toolitem action="AM"/> - <toolitem action="FM"/> - <toolitem action="SSB"/> - </placeholder> - </toolbar> - </ui>''' - - def build_gui(self): - # Create the toplevel window - window = gtk.Window() - vbox = gtk.VBox() - window.add(vbox) - - # Create a UIManager instance - uimanager = gtk.UIManager() - self.uimanager = uimanager - - # Create the base ActionGroup - actiongroup = gtk.ActionGroup('UIMergeExampleBase') - - actiongroup.add_actions([('File', None, '_File'), - ('Sound', None, '_Sound'), - ('RadioBand', None, '_Radio Band')]) - uimanager.insert_action_group(actiongroup, 0) - - # Create an ActionGroup - actiongroup0 = gtk.ActionGroup('UIMergeExample0') - - # Create a ToggleAction, etc. - actiongroup0.add_toggle_actions([('Mute', None, '_Mute', '<Control>m', - 'Mute the volume', self.cb)]) - - # Create actions - actiongroup0.add_actions([('Quit', gtk.STOCK_QUIT, '_Quit me!', None, - 'Quit the Program', self.cb)]) - - # Create some RadioActions - actiongroup0.add_radio_actions([('AM', None, '_AM', '<Control>a', - 'AM Radio', 0), - ('FM', None, '_FM', '<Control>f', - 'FM Radio', 1), - ('SSB', None, '_SSB', '<Control>b', - 'SSB Radio', 2), - ], 0, self.cb) - - # Add the actiongroup to the uimanager - uimanager.insert_action_group(actiongroup0, 1) - - self.ag0 = actiongroup0 - del actiongroup0 - - # Add a UI description - self.merge_id0 = uimanager.add_ui_from_string(self.ui0) - - # Create a MenuBar - menubar = uimanager.get_widget('/MenuBar') - vbox.pack_start(menubar, False) - - # Create a Toolbar - toolbar = uimanager.get_widget('/Toolbar') - vbox.pack_start(toolbar, False) - - gobject.timeout_add(50, self.timeout_cb) - - gtk.main() - return - - def timeout_cb(self): - ag0 = self.ag0 - uimanager = self.uimanager - del self.ag0, self.uimanager - - uimanager.remove_ui(self.merge_id0) - uimanager.remove_action_group(ag0) - - gc.collect() # Clean out unreachable objects - - del ag0 - assert gc.collect() == 1 # Collect just the ActionGroup - - uimanager.ensure_update() - assert gc.collect() == 6 # Now the GtkActions have lost their last - # GObject reference; they should be collected. - # We have a ToggleAction, an Action and a - # RadioAction, plus self.cb is bound in three - # closures. - - gtk.main_quit() - - def testActionGroups(self): - self.build_gui() - - def cb(self, action): - return - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_dialog.py b/tests/test_dialog.py deleted file mode 100644 index 7fc168d3..00000000 --- a/tests/test_dialog.py +++ /dev/null @@ -1,24 +0,0 @@ -import sys -import unittest - -from common import gtk - -class MessageDialogTest(unittest.TestCase): - def testDialogAdd(self): - dialog = gtk.MessageDialog() - - response_id = sys.maxint + 1 - self.assertRaises(OverflowError, dialog.add_button, "Foo", response_id) - self.assertRaises(OverflowError, dialog.add_buttons, "Foo", response_id) - - def testSubclass(self): - # Normal subclassing should not register a type - sub = type('sub', (gtk.MessageDialog,), {}) - self.assertEqual(sub.__gtype__.name, 'GtkMessageDialog') - - # This depends on 311254 - #type('Sub', (gtk.MessageDialog,), {'__gtype_name__': 'SubDialog'}) - #self.assertEqual(sub.__gtype__.name, 'SubDialog') - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_gdk.py b/tests/test_gdk.py deleted file mode 100644 index 7bbaf9ae..00000000 --- a/tests/test_gdk.py +++ /dev/null @@ -1,12 +0,0 @@ -import unittest - -from common import gtk - -class GdkTest(unittest.TestCase): - def testBitmapCreateFromData(self): - gtk.gdk.bitmap_create_from_data(None, '\x00', 1, 1) - - def testPixmapCreateFromData(self): - black = gtk.gdk.color_parse('black') - gtk.gdk.pixmap_create_from_data(None, '\x00', 1, 1, 1, - black, black) diff --git a/tests/test_gdkevent.py b/tests/test_gdkevent.py deleted file mode 100644 index 9ba0613a..00000000 --- a/tests/test_gdkevent.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- Mode: Python -*- - -import unittest - -from common import gtk - -class TestGdkEvent(unittest.TestCase): - def testWindowSetter(self): - event = gtk.gdk.Event(gtk.gdk.BUTTON_PRESS) - - win1 = gtk.Window() - win1.realize() - event.window = win1.window - self.assertEqual(event.window, win1.window) - - win2 = gtk.Window() - win2.realize() - event.window = win2.window - self.assertEqual(event.window, win2.window) - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_glade.py b/tests/test_glade.py deleted file mode 100644 index ce9b99e8..00000000 --- a/tests/test_glade.py +++ /dev/null @@ -1,33 +0,0 @@ -import unittest - -from common import gtk, gobject -import weakref -import gc - -class TestGlade(unittest.TestCase): - - class SimpleTest: - def __init__(self, test): - xml = gtk.glade.XML('leak.glade') - xml.signal_autoconnect(self) - self.test = test - self.window = xml.get_widget("window1") - self.window.destroy() - def on_window1_destroy(self, window): - gobject.idle_add(self.test.leak_check, weakref.ref(self), weakref.ref(self.window)) - - def leak_check(self, objref, windowref): - while gc.collect(): - pass - gtk.main_quit() - self.assertEqual(objref(), None) - self.windowref = windowref - - def testAutoconnectLeak(self): - self.SimpleTest(self) - gtk.main() - self.assertEqual(self.windowref(), None) - - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_gtype.py b/tests/test_gtype.py index eb89a878..b8177fd6 100644 --- a/tests/test_gtype.py +++ b/tests/test_gtype.py @@ -1,7 +1,7 @@ import unittest from gobject import GType -from common import gobject, gtk +from common import gobject class GTypeTest(unittest.TestCase): def checkType(self, expected, *objects): @@ -23,9 +23,9 @@ class GTypeTest(unittest.TestCase): def testInt(self): self.checkType(gobject.TYPE_INT, 'gint', int) - model = gtk.ListStore(str, int) - iter = model.append() - model.set(iter, 1, 100000000) + # model = gtk.ListStore(str, int) + # iter = model.append() + # model.set(iter, 1, 100000000) def testInt64(self): self.checkType(gobject.TYPE_INT64, 'gint64') diff --git a/tests/test_liststore.py b/tests/test_liststore.py deleted file mode 100644 index a5d9f616..00000000 --- a/tests/test_liststore.py +++ /dev/null @@ -1,24 +0,0 @@ -import unittest - -from common import gtk - -class ListStoreTest(unittest.TestCase): - def testConstructor(self): - self.assertRaises(TypeError, gtk.ListStore) - - def testInsert(self): - store = gtk.ListStore(int) - - # Old way, with iters - store.set_value(store.insert(0), 0, 2) - self.assertEqual(len(store), 1) - self.assertEqual(store[0][0], 2) - - # New way - store.insert(0, (1,)) - self.assertEqual(len(store), 2) - self.assertEqual(store[0][0], 1) - self.assertEqual(store[1][0], 2) - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_radiobutton.py b/tests/test_radiobutton.py deleted file mode 100644 index 98d86dd6..00000000 --- a/tests/test_radiobutton.py +++ /dev/null @@ -1,98 +0,0 @@ -import unittest - -from common import gtk - -class RadioTest(unittest.TestCase): - widget_type = None - constructor_args = () - - def new(self): - return self.widget_type(*self.constructor_args) - - def newLabel(self, label): - return self.widget_type(None, label) - - def newGroup(self, group): - return self.widget_type(group) - - def getLabel(self, obj): - return obj.get_property('label') - - def compareGroups(self, group1, group2): - return self.assertEqual(group1, group2) - - def testCreate(self): - if self.widget_type is None: - return - radio = self.new() - self.assert_(isinstance(radio, self.widget_type)) - - def testLabel(self): - if self.widget_type is None: - return - radio = self.newLabel('test-radio') - self.assertEqual(self.getLabel(radio), 'test-radio') - - def testGroup(self): - if self.widget_type is None: - return - radio = self.new() - radio2 = self.newGroup(radio) - self.compareGroups(radio.get_group(), radio2.get_group()) - self.compareGroups(radio2.get_group(), radio.get_group()) - - def testEmptyGroup(self): - if self.widget_type is None: - return - radio = self.new() - radio2 = self.new() - self.compareGroups(radio.get_group(), [radio]) - self.compareGroups(radio2.get_group(), [radio2]) - radio2.set_group(radio) - self.compareGroups(radio.get_group(), radio2.get_group()) - self.compareGroups(radio2.get_group(), radio.get_group()) - radio2.set_group(None) - self.compareGroups(radio.get_group(), [radio]) - self.compareGroups(radio2.get_group(), [radio2]) - -class RadioButtonTest(RadioTest): - widget_type = gtk.RadioButton - -class RadioActionTest(RadioTest): - widget_type = gtk.RadioAction - constructor_args = ('RadioAction', 'test-radio-action', '', '', 0) - - def newGroup(self, radio): - # No constructor, so set it manually - obj = self.new() - obj.set_group(radio) - return obj - - def newLabel(self, label): - return gtk.RadioAction('RadioAction', label, '', '', 0) - -class RadioToolButtonTest(RadioTest): - widget_type = gtk.RadioToolButton - - def compareGroups(self, group1, group2): - # GtkRadioToolButton.set/get_groups return GtkRadioButtons, - # so instead of doing a normal cmp, compare ids - return cmp(map(id, group1), map(id, group2)) - - def newLabel(self, label): - # We don't have a constructor for which we can pass in a label - # for, so just call set_label instead - radio = gtk.RadioToolButton(None) - radio.set_label(label) - return radio - -class RadioMenuItem(RadioTest): - widget_type = gtk.RadioMenuItem - - def getLabel(self, obj): - # The label is stored in a gtk.AccelLabel, which is the only - # child of the RadioMenuItem. - return obj.get_child().get_text() - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_signal.py b/tests/test_signal.py index 5513f2f1..36014fc3 100644 --- a/tests/test_signal.py +++ b/tests/test_signal.py @@ -3,7 +3,7 @@ import gc import unittest -from common import gobject, gtk +from common import gobject class C(gobject.GObject): __gsignals__ = { 'my_signal': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, @@ -73,49 +73,9 @@ class TestGPropertyError(unittest.TestCase): self.assertRaises(TypeError, foo) gc.collect() - -class DrawingArea(gtk.DrawingArea): - __gsignals__ = { 'my-activate': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, ()) , - 'my-adjust': (gobject.SIGNAL_RUN_FIRST, - gobject.TYPE_NONE, - (gtk.Adjustment, gtk.Adjustment)) } - def __init__(self): - gtk.DrawingArea.__init__(self) - self.activated = False - self.adjusted = False - - def do_my_activate(self): - self.activated = True - - def do_my_adjust(self, hadj, vadj): - self.adjusted = True - -DrawingArea.set_activate_signal('my-activate') -DrawingArea.set_set_scroll_adjustments_signal('my-adjust') - -class TestOldStyleOverride(unittest.TestCase): - def testActivate(self): - b = DrawingArea() - self.assertEqual(b.activated, False) - b.activate() - self.assertEqual(b.activated, True) - - def testSetScrollAdjustment(self): - b = DrawingArea() - self.assertEqual(b.adjusted, False) - b.set_scroll_adjustments(gtk.Adjustment(), gtk.Adjustment()) - self.assertEqual(b.adjusted, True) - class TestList(unittest.TestCase): def testListObject(self): self.assertEqual(gobject.signal_list_names(C), ('my-signal',)) - def testListInterface(self): - signals = gobject.signal_list_names(gtk.Editable) - self.failUnless('changed' in signals) - self.failUnless('insert-text' in signals) - self.failUnless('delete-text' in signals) - if __name__ == '__main__': unittest.main() diff --git a/tests/test_subtype.py b/tests/test_subtype.py index 91a1e71a..99fbb3b1 100644 --- a/tests/test_subtype.py +++ b/tests/test_subtype.py @@ -1,7 +1,7 @@ import unittest import testmodule -from common import gobject, gtk, testhelper +from common import gobject, testhelper from gobject import GObject, GInterface class TestSubType(unittest.TestCase): @@ -9,28 +9,18 @@ class TestSubType(unittest.TestCase): t = type('testtype', (GObject, GInterface), {}) self.failUnless(issubclass(t, GObject)) self.failUnless(issubclass(t, GInterface)) - t = type('testtype2', (GObject, gtk.TreeModel), {}) - self.failUnless(issubclass(t, GObject)) - self.failUnless(issubclass(t, gtk.TreeModel)) - def testTpBasicSize(self): - self.assertEqual(GObject.__basicsize__, - gtk.Widget.__basicsize__) - - self.assertEqual(GInterface.__basicsize__, - gtk.TreeModel.__basicsize__) - - def testLabel(self): - label = gtk.Label() + def testGObject(self): + label = gobject.GObject() self.assertEqual(label.__grefcount__, 1) - label = gobject.new(gtk.Label) + label = gobject.new(gobject.GObject) self.assertEqual(label.__grefcount__, 1) def testPythonSubclass(self): - label = testmodule.PyLabel() + label = testmodule.PyGObject() self.assertEqual(label.__grefcount__, 1) self.assertEqual(label.props.label, "hello") - label = gobject.new(testmodule.PyLabel) + label = gobject.new(testmodule.PyGObject) self.assertEqual(label.__grefcount__, 1) self.assertEqual(label.props.label, "hello") @@ -40,39 +30,8 @@ class TestSubType(unittest.TestCase): refcount = testhelper.test_g_object_new() self.assertEqual(refcount, 2) - def testMassiveGtkSubclassing(self): - for name, cls in [(name, getattr(gtk, name)) for name in dir(gtk)]: - ## Skip some deprecated types - if name in ['CTree', '_gobject']: - continue - try: - if not issubclass(cls, gobject.GObject): - continue - except TypeError: # raised by issubclass if cls is not a class - continue - subname = name + "PyGtkTestSubclass" - sub = type(subname, (cls,), {'__gtype_name__': subname }) - - def testGtkWindowObjNewRefcount(self): - foo = gobject.new(gtk.Window) - self.assertEqual(foo.__grefcount__, 2) - - def testGtkWindowFactoryRefcount(self): - foo = gtk.Window() - self.assertEqual(foo.__grefcount__, 2) - - def testPyWindowObjNewRefcount(self): - PyWindow = type('PyWindow', (gtk.Window,), dict(__gtype_name__='PyWindow1')) - foo = gobject.new(PyWindow) - self.assertEqual(foo.__grefcount__, 2) - - def testGtkWindowFactoryRefcount(self): - PyWindow = type('PyWindow', (gtk.Window,), dict(__gtype_name__='PyWindow2')) - foo = PyWindow() - self.assertEqual(foo.__grefcount__, 2) - def testRegisterArgNotType(self): self.assertRaises(TypeError, gobject.type_register, 1) def testGObjectNewError(self): - self.assertRaises(TypeError, gobject.new, gtk.Label, text='foo') + self.assertRaises(TypeError, gobject.new, gobject.GObject, text='foo') diff --git a/tests/test_textview.py b/tests/test_textview.py deleted file mode 100644 index 5022fdac..00000000 --- a/tests/test_textview.py +++ /dev/null @@ -1,14 +0,0 @@ -import sys -import unittest - -from common import gtk - -class TextViewTest(unittest.TestCase): - def test_default_attributes(self): - textview = gtk.TextView() - attrs = textview.get_default_attributes() - textview.destroy() - self.assertEqual(attrs.font_scale, 1.0) - -if __name__ == '__main__': - unittest.main() diff --git a/tests/test_thread.py b/tests/test_thread.py index 647783ac..231930f1 100644 --- a/tests/test_thread.py +++ b/tests/test_thread.py @@ -1,7 +1,8 @@ import os import unittest -from common import gobject, gtk, testhelper +from common import gobject, testhelper +main = gobject.MainLoop() class TestThread(unittest.TestCase): def from_thread_cb(self, test, enum): @@ -17,7 +18,7 @@ class TestThread(unittest.TestCase): def testExtensionModule(self): gobject.idle_add(self.idle_cb) gobject.timeout_add(50, self.timeout_cb) - gtk.main() + main.run() def timeout_cb(self): - gtk.main_quit() + main.quit() diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c index 76847210..b849344b 100644 --- a/tests/testhelpermodule.c +++ b/tests/testhelpermodule.c @@ -15,9 +15,9 @@ test_type_get_type(void) GTypeInfo *type_info; GTypeQuery query; - parent_type = g_type_from_name("PyLabel"); + parent_type = g_type_from_name("PyGObject"); if (parent_type == 0) - g_error("could not get PyLabel from testmodule"); + g_error("could not get PyGObject from testmodule"); type_info = (GTypeInfo *)g_new0(GTypeInfo, 1); @@ -74,7 +74,7 @@ _wrap_test_g_object_new (PyObject * self) GObject *obj; PyObject *rv; - obj = g_object_new(g_type_from_name("PyLabel"), NULL); + obj = g_object_new(g_type_from_name("PyGObject"), NULL); rv = PyInt_FromLong(obj->ref_count); /* should be == 2 at this point */ g_object_unref(obj); return rv; diff --git a/tests/testmodule.py b/tests/testmodule.py index 8761ecfc..2fda01f3 100644 --- a/tests/testmodule.py +++ b/tests/testmodule.py @@ -1,9 +1,21 @@ import gobject -import gtk - -class PyLabel(gtk.Label): - __gtype_name__ = 'PyLabel' +class PyGObject(gobject.GObject): + __gtype_name__ = 'PyGObject' + __gproperties__ = { + 'label': (gobject.TYPE_STRING, + 'label property', + 'the label of the object', + 'default', gobject.PARAM_READWRITE), + } + def __init__(self): - gtk.Label.__init__(self, "hello") + self._props = {} + gobject.GObject.__init__(self) + self.set_property('label', 'hello') + def do_set_property(self, name, value): + self._props[name] = value + + def do_get_property(self, name): + return self._props[name] |