setup.py 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #!/usr/bin/env python
  2. #
  3. # mmgen = Multi-Mode GENerator, command-line Bitcoin cold storage solution
  4. # Copyright (C)2013-2016 Philemon <mmgen-py@yandex.com>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. from distutils.core import setup,Extension
  19. from distutils.command.build_ext import build_ext
  20. from distutils.command.install_data import install_data
  21. import sys,os
  22. from shutil import copy2
  23. import subprocess as sp
  24. _gvi = sp.check_output(['gcc','--version']).splitlines()[0]
  25. have_mingw_64 = 'x86_64' in _gvi and 'MinGW' in _gvi
  26. # install extension module in repository after building
  27. class my_build_ext(build_ext):
  28. def build_extension(self,ext):
  29. build_ext.build_extension(self,ext)
  30. ext_src = self.get_ext_fullpath(ext.name)
  31. ext_dest = self.get_ext_filename(ext.name)
  32. try: os.unlink(ext_dest)
  33. except: pass
  34. os.chmod(ext_src,0755)
  35. print 'copying %s to %s' % (ext_src,ext_dest)
  36. copy2(ext_src,ext_dest)
  37. class my_install_data(install_data):
  38. def run(self):
  39. for f in 'mmgen.cfg','mnemonic.py','mn_wordlist.c':
  40. os.chmod(os.path.join('data_files',f),0644)
  41. install_data.run(self)
  42. module1 = Extension(
  43. name = 'mmgen.secp256k1',
  44. sources = ['extmod/secp256k1mod.c'],
  45. libraries = ['secp256k1'],
  46. library_dirs = ['/usr/local/lib',r'c:\msys\local\lib'],
  47. # mingw32 needs this, Linux can use it, but it breaks mingw64
  48. extra_link_args = (['-lgmp'],[])[have_mingw_64],
  49. include_dirs = ['/usr/local/include',r'c:\msys\local\include'],
  50. )
  51. from mmgen.globalvars import g
  52. setup(
  53. name = 'mmgen',
  54. description = 'A complete Bitcoin offline/online wallet solution for the command line',
  55. version = g.version,
  56. author = 'Philemon',
  57. author_email = 'mmgen-py@yandex.com',
  58. url = 'https://github.com/mmgen/mmgen',
  59. license = 'GNU GPL v3',
  60. platforms = 'Linux, MS Windows, Raspberry PI',
  61. keywords = 'Bitcoin, wallet, cold storage, offline storage, open-source, command-line, Python, Bitcoin Core, bitcoind, hd, deterministic, hierarchical, secure, anonymous',
  62. cmdclass = { 'build_ext': my_build_ext, 'install_data': my_install_data },
  63. ext_modules = [module1],
  64. data_files = [('share/mmgen', [
  65. 'data_files/mmgen.cfg', # source files must have 0644 mode
  66. 'data_files/mn_wordlist.c',
  67. 'data_files/mnemonic.py'
  68. ]),],
  69. py_modules = [
  70. 'mmgen.__init__',
  71. 'mmgen.addr',
  72. 'mmgen.bitcoin',
  73. 'mmgen.globalvars',
  74. 'mmgen.common',
  75. 'mmgen.crypto',
  76. 'mmgen.filename',
  77. 'mmgen.license',
  78. 'mmgen.mn_electrum',
  79. 'mmgen.mn_tirosh',
  80. 'mmgen.obj',
  81. 'mmgen.opts',
  82. 'mmgen.rpc',
  83. 'mmgen.seed',
  84. 'mmgen.term',
  85. 'mmgen.test',
  86. 'mmgen.tool',
  87. 'mmgen.tx',
  88. 'mmgen.tw',
  89. 'mmgen.util',
  90. 'mmgen.main',
  91. 'mmgen.main_addrgen',
  92. 'mmgen.main_addrimport',
  93. 'mmgen.main_tool',
  94. 'mmgen.main_txcreate',
  95. 'mmgen.main_txsend',
  96. 'mmgen.main_txsign',
  97. 'mmgen.main_wallet',
  98. 'mmgen.share.__init__',
  99. 'mmgen.share.Opts',
  100. ],
  101. scripts=[
  102. 'mmgen-addrgen',
  103. 'mmgen-keygen',
  104. 'mmgen-addrimport',
  105. 'mmgen-passchg',
  106. 'mmgen-walletchk',
  107. 'mmgen-walletconv',
  108. 'mmgen-walletgen',
  109. 'mmgen-txcreate',
  110. 'mmgen-txsign',
  111. 'mmgen-txsend',
  112. 'mmgen-tool'
  113. ]
  114. )