PATCH: Fix packaging glitch

Mark Mitchell mark at codesourcery.com
Fri Feb 27 22:20:24 UTC 2004


The code in setup.py that tried to decide whether we were building a
Windows package or a UNIX package, and name the main QMTest script
"qmtest" or "qmtest.py" accordingly, was very fragile.  So fragile
that the Windows 2.1.1 release packages failed to contain "qmtest.py",
which is a major glitch.

This patch removes this fragility and been committed on the 2.1 branch
and the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery.com


2004-02-27  Mark Mitchell  <mark at codesourcery.com>

	* setup.py: Install both "qmtest" and "qmtest.py" on all systems.

Index: setup.py
===================================================================
RCS file: /home/qm/Repository/qm/setup.py,v
retrieving revision 1.9
diff -c -5 -p -r1.9 setup.py
*** setup.py	4 Dec 2003 02:38:08 -0000	1.9
--- setup.py	27 Feb 2004 21:59:55 -0000
*************** tutorial_files = files_with_ext("qm/test
*** 84,108 ****
  test_dtml_files = files_with_ext("qm/test/share/dtml", ".dtml")
  
  share_files = {}
  os.path.walk("share", select_share_files, share_files)
  
! # On UNIX, we want the main script to be "qmtest".  On Windows, we need
! # to use a ".py" extension so that users can invoke the script directly;
! # if we were to omit the ".py" extension they would have to explicitly
! # type "python qmtest" to invoke the script.  Searching for
! # "bdist_wininst" in sys.argv is an (inelegant) way of checking to see
! # if we are building a Windows binary installer.
  qmtest_script = join("qm", "test", "qmtest")
! py_script = qmtest_script + ".py"
! if "bdist_wininst" in sys.argv:
!     shutil.copyfile(qmtest_script, py_script)
!     qmtest_script = py_script
! elif os.path.exists(py_script):
!     # Avoid accidentally packaging the ".py" version of the script, if
!     # it exists.
!     os.remove(py_script)
       
  setup(name="qm", 
        version=version,
        author="CodeSourcery, LLC",
        author_email="info at codesourcery.com",
--- 84,100 ----
  test_dtml_files = files_with_ext("qm/test/share/dtml", ".dtml")
  
  share_files = {}
  os.path.walk("share", select_share_files, share_files)
  
! # On UNIX, users invoke "qmtest".  On Windows, there is no way to make a
! # Python script directly executable, unless its suffix is ".py".  It is
! # difficult to get distutils to install just one script or the other, so
! # we install both on all platforms.
  qmtest_script = join("qm", "test", "qmtest")
! qmtest_py_script = qmtest_script + ".py"
! shutil.copyfile(qmtest_script, qmtest_py_script)
       
  setup(name="qm", 
        version=version,
        author="CodeSourcery, LLC",
        author_email="info at codesourcery.com",
*************** setup(name="qm", 
*** 122,132 ****
                  'qm/external',
                  'qm/external/DocumentTemplate',
                  'qm/test',
                  'qm/test/classes',
                  'qm/test/web'),
!       scripts=[qmtest_script],
        data_files=[('qm/messages/test',
                     prefix(messages, 'qm/test/share/messages')),
                    # DTML files for the GUI.
                    ("qm/dtml/test", test_dtml_files),
                    # The documentation.
--- 114,124 ----
                  'qm/external',
                  'qm/external/DocumentTemplate',
                  'qm/test',
                  'qm/test/classes',
                  'qm/test/web'),
!       scripts=[qmtest_script, qmtest_py_script],
        data_files=[('qm/messages/test',
                     prefix(messages, 'qm/test/share/messages')),
                    # DTML files for the GUI.
                    ("qm/dtml/test", test_dtml_files),
                    # The documentation.



More information about the qmtest mailing list