Skip to content

Instantly share code, notes, and snippets.

@rabialam
Created December 18, 2012 02:51
Show Gist options
  • Save rabialam/4324565 to your computer and use it in GitHub Desktop.
Save rabialam/4324565 to your computer and use it in GitHub Desktop.
patch to music21 to make installable via pip (lightly modified from http://code.google.com/p/music21/issues/detail?id=57)
Index: music21/setup.py
===================================================================
--- music21/setup.py (revision 1238)
+++ music21/setup.py (working copy)
@@ -10,16 +10,17 @@
# License: LGPL
#-------------------------------------------------------------------------------
+try:
+ from setuptools import setup, find_packages
+except ImportError:
+ from ez_setup import use_setuptools
+ use_setuptools()
+ from setuptools import setup, find_packages
+
import sys, os
import music21
from music21 import common
-
-DESCRIPTION = 'A Toolkit for Computer-Aided Musical Analysis and Manipulation.'
-DESCRIPTION_LONG = 'A Toolkit for Computer-Aided Musical Analysis and Manipulation. Developed at MIT. Michael Scott Cuthbert, Principal Investigator, Christopher Ariza, Lead Programmer. The development of music21 is supported by the generosity of the Seaver Institute.'
-
-
-
def _getPackagesList():
"""List of all packages, delimited by period, with relative path names. Assigned to setup.py's `packages` argument.
"""
@@ -60,24 +61,6 @@
def _getClassifiers():
# http://pypi.python.org/pypi?:action=list_classifiers
- classifiers = [
- 'Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: End Users/Desktop',
- 'Intended Audience :: Developers',
- 'Intended Audience :: Education',
- 'Intended Audience :: Science/Research',
- 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
- 'Natural Language :: English',
- 'Operating System :: MacOS',
- 'Operating System :: Microsoft :: Windows',
- 'Operating System :: POSIX',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Topic :: Multimedia :: Sound/Audio',
- 'Topic :: Artistic Software',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- ]
return classifiers
@@ -99,51 +83,79 @@
-def runDisutils(bdistType=None):
- '''The main distutils routine.
-
- When called without arguments, this performs a standard distutils installation.
- '''
- if bdistType == 'bdist_egg':
- print('using setuptools')
- from setuptools import setup
- else:
- from distutils.core import setup
-
- setup(name = 'music21',
- version = music21.VERSION_STR,
- description = DESCRIPTION,
- long_description = DESCRIPTION_LONG,
- author = 'Michael Scott Cuthbert, Christopher Ariza, others',
- #author_email = '',
- license = 'LGPL',
- url = 'http://code.google.com/p/music21',
- classifiers = _getClassifiers(),
- download_url = 'http://music21.googlecode.com/files/music21-%s.tar.gz' % music21.VERSION_STR,
- packages = _getPackagesList(),
- package_data = {'music21': _getPackageData()},
- ) # close setup args
+# def runDisutils(bdistType=None):
+# '''The main distutils routine.
+#
+# When called without arguments, this performs a standard distutils installation.
+# '''
+# if bdistType == 'bdist_egg':
+# print('using setuptools')
+# from setuptools import setup
+# else:
+# from distutils.core import setup
+#
+# setup(name = 'music21',
+# version = music21.VERSION_STR,
+# description = DESCRIPTION,
+# long_description = DESCRIPTION_LONG,
+# author = 'Michael Scott Cuthbert, Christopher Ariza, others',
+# #author_email = '',
+# license = 'LGPL',
+# url = 'http://code.google.com/p/music21',
+# classifiers = _getClassifiers(),
+# download_url = 'http://music21.googlecode.com/files/music21-%s.tar.gz' % music21.VERSION_STR,
+# packages = _getPackagesList(),
+# package_data = {'music21': _getPackageData()},
+# ) # close setup args
#-------------------------------------------------------------------------------
if len(sys.argv) == 1: # no args
print('welcome to music21\nto run setup.py for installation, enter, as an administrator (or with sudo): python setup.py install\n')
+ print('No action specified. Exiting.')
+ sys.exit(0)
-elif sys.argv[1] in ['bdist', 'sdist', 'register', 'bdist_mpkg',
- 'bdist_rpm', 'bdist_deb', 'bdist_wininst',
- 'bdist_egg']:
- import music21
+DESCRIPTION = 'A Toolkit for Computer-Aided Musical Analysis and Manipulation.'
+DESCRIPTION_LONG = 'A Toolkit for Computer-Aided Musical Analysis and Manipulation. Developed at MIT. Michael Scott Cuthbert, Principal Investigator, Christopher Ariza, Lead Programmer. The development of music21 is supported by the generosity of the Seaver Institute.'
+CLASSIFIERS = [
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: End Users/Desktop',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Education',
+ 'Intended Audience :: Science/Research',
+ 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
+ 'Natural Language :: English',
+ 'Operating System :: MacOS',
+ 'Operating System :: Microsoft :: Windows',
+ 'Operating System :: POSIX',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python',
+ 'Topic :: Multimedia :: Sound/Audio',
+ 'Topic :: Artistic Software',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ ]
+
+if sys.argv[1] in ['bdist', 'sdist', 'register', 'bdist_mpkg',
+ 'bdist_rpm', 'bdist_deb', 'bdist_wininst',
+ 'bdist_egg', 'develop']:
fpMusic21 = music21.__path__[0] # list, get first item
fpPackageDir = os.path.dirname(fpMusic21)
print('fpPackageDir = %s' % fpPackageDir)
writeManifestTemplate(fpPackageDir)
- runDisutils(sys.argv[1])
+ #runDisutils(sys.argv[1])
-elif sys.argv[1] in ['install']:
- runDisutils('install')
-else:
- print('cannot process provided arguments: %s\n' % sys.argv[1:])
-
-
+setup(name = 'music21',
+ version = music21.VERSION_STR,
+ description = DESCRIPTION,
+ long_description = DESCRIPTION_LONG,
+ author = 'Michael Scott Cuthbert, Christopher Ariza, others',
+ license = 'LGPL',
+ url = 'http://code.google.com/p/music21',
+ classifiers = CLASSIFIERS,
+ download_url = 'http://music21.googlecode.com/files/music21-%s.tar.gz' % music21.VERSION_STR,
+ packages = _getPackagesList(),
+ package_data = {'music21': _getPackageData()},
+) # close setup args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment