Permalink
Browse files

Convert setup.py to use setuptools

Due to r1667, setup.py was left broken installing 'gyp' as a script, which happened to be the *nix invocation script wrapper.

By converting setup.py to use setuptools, when the gyp script is installed, the appropriate file name will be generated to match the local conventions on both *nix and Windows platforms.

This change required adding a proxy function in gyp/__init__.py, called 'script_main', which takes 0 arguments as required by setuptools that directly ends up calling 'main' passing along sys.argv[1:].  Other areas in gyp/__init__.py and gyp_main.py were modified to use this new function as well.

The MANIFEST file was deleted since setuptools automatically includes the correct files in source distributions.

Contributed by ericvw@gmail.com

BUG=None
R=scottmg@chromium.org

Review URL: https://codereview.chromium.org/22816026

git-svn-id: http://gyp.googlecode.com/svn/trunk@1713 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information...
1 parent cce0101 commit e7d6d052f9e0cbba7ca11414495c54207f4aacfe sbaig1@bloomberg.net committed Sep 4, 2013
Showing with 10 additions and 30 deletions.
  1. +0 −19 MANIFEST
  2. +1 −1 gyp_main.py
  3. +5 −1 pylib/gyp/__init__.py
  4. +4 −9 setup.py
View
@@ -1,19 +0,0 @@
-setup.py
-gyp
-LICENSE
-AUTHORS
-pylib/gyp/MSVSNew.py
-pylib/gyp/MSVSProject.py
-pylib/gyp/MSVSToolFile.py
-pylib/gyp/MSVSUserFile.py
-pylib/gyp/MSVSVersion.py
-pylib/gyp/__init__.py
-pylib/gyp/common.py
-pylib/gyp/input.py
-pylib/gyp/xcodeproj_file.py
-pylib/gyp/generator/__init__.py
-pylib/gyp/generator/gypd.py
-pylib/gyp/generator/gypsh.py
-pylib/gyp/generator/make.py
-pylib/gyp/generator/msvs.py
-pylib/gyp/generator/xcode.py
View
@@ -15,4 +15,4 @@
import gyp
if __name__ == '__main__':
- sys.exit(gyp.main(sys.argv[1:]))
+ sys.exit(gyp.script_main())
View
@@ -542,5 +542,9 @@ def main(args):
sys.stderr.write("gyp: %s\n" % e)
return 1
+# NOTE: setuptools generated console_scripts calls function with no arguments
+def script_main():
+ return main(sys.argv[1:])
+
if __name__ == '__main__':
- sys.exit(main(sys.argv[1:]))
+ sys.exit(script_main())
View
@@ -4,10 +4,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-from distutils.core import setup
-from distutils.command.install import install
-from distutils.command.install_lib import install_lib
-from distutils.command.install_scripts import install_scripts
+from ez_setup import use_setuptools
+use_setuptools()
+from setuptools import setup
setup(
name='gyp',
@@ -18,9 +17,5 @@
url='http://code.google.com/p/gyp',
package_dir = {'': 'pylib'},
packages=['gyp', 'gyp.generator'],
-
- scripts = ['gyp'],
- cmdclass = {'install': install,
- 'install_lib': install_lib,
- 'install_scripts': install_scripts},
+ entry_points = {'console_scripts': ['gyp=gyp:script_main'] }
)

0 comments on commit e7d6d05

Please sign in to comment.