def test_console_example(): responses.add_callback( 'GET', re.compile(r'https://www.python.org/ftp/.*'), callback=respond_python_zip, content_type='application/zip', ) with TemporaryWorkingDirectory() as td: for src in example_dir.iterdir(): copy(str(src), td) with modified_env({CACHE_ENV_VAR: td}), \ MockCommand('makensis') as makensis: ec = main(['installer.cfg']) assert ec == 0 assert makensis.get_calls()[0]['argv'][1].endswith('installer.nsi') build_dir = Path(td, 'build', 'nsis') assert_isdir(build_dir) assert_isfile(build_dir / 'Python' / 'python.exe') assert_isfile(build_dir / 'pkgs' / 'guessnumber.py') assert_isfile(build_dir / 'Guess_the_Number.launch.py')
def test_console_example(tmp_path, console_eg_copy, monkeypatch): responses.add_callback( 'GET', re.compile(r'https://www.python.org/ftp/.*'), callback=respond_python_zip, content_type='application/zip', ) monkeypatch.chdir(console_eg_copy) monkeypatch.setenv(CACHE_ENV_VAR, str(tmp_path / 'cache')) with MockCommand('makensis') as makensis: ec = main(['installer.cfg']) assert ec == 0 assert makensis.get_calls()[0]['argv'][1].endswith('installer.nsi') build_dir = console_eg_copy / 'build' / 'nsis' assert_isdir(build_dir) assert_isfile(build_dir / 'Python' / 'python.exe') assert_isfile(build_dir / 'pkgs' / 'sample_printer' / '__init__.py') assert_isfile(build_dir / 'Sample_printer.launch.py')
def test_console_example(): responses.add_callback('GET', re.compile(r'https://www.python.org/ftp/.*'), callback=respond_python_zip, content_type='application/zip', ) with TemporaryWorkingDirectory() as td: for src in example_dir.iterdir(): copy(str(src), td) with modified_env({CACHE_ENV_VAR: td}), \ MockCommand('makensis') as makensis: ec = main(['installer.cfg']) assert ec == 0 assert makensis.get_calls()[0]['argv'][1].endswith('installer.nsi') build_dir = Path(td, 'build', 'nsis') assert_isdir(build_dir) assert_isfile(build_dir / 'Python' / 'python.exe') assert_isfile(build_dir / 'pkgs' / 'guessnumber.py') assert_isfile(build_dir / 'Guess_the_Number.launch.py')
import os import nsist example_cfgs = [ 'console/installer.cfg', 'pyqt/installer.cfg', 'tkinter/installer.cfg', 'pygame/installer.cfg', ] examples_dir = os.path.dirname(os.path.abspath(__file__)) for example_cfg in example_cfgs: os.chdir(examples_dir) nsist.main([example_cfg])
import os import nsist distrs_dir = os.path.dirname(os.path.abspath(__file__)) os.system('delete /Q build') nsist.main(['installer.cfg'])
import os import nsist cfg_file = './installer.cfg' dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(dir) nsist.main([cfg_file])