Installing a profile inherited from an existing distribution I would like to build a distribution based on the Standard profile coming with Drupal 7, by inheriting all the features of the parent distro and changing some of them with custom code.

The title of this question sounds very similar to "Is there a way to inherit a Drupal installation profile?". While the referenced post deals with building the code base, ie a .make file, here I am interested in site installation of a distro made of profilename.info, profilename.install and profilename.profile.

There is a solution proposed in [How to Write a Drupal 7 Installation Profile][2], that seems quite simple. So I tried the following code in mydistro.profile:

function mydistro_install() {
  include_once DRUPAL_ROOT . '/profiles/standard/standard.install';
  standard_install();
}


If this worked I could add custom features further down in the process.
Then I ran site-install with drush:

drush -d si mydistro -y --db-url=mysql://root:secret@localhost/mydistro_com 


The process installs the database with 43 tables (out of 74 that come with the standard profile), and enables the following modules:

user, field_sql_storage, filter, node, field, text

and then throws this error message:

exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table                              [error]
'mydistro_com.block' doesn't exist' in C:\xampp\htdocs\mydistro.com\includes\database\database.inc:2171
Stack trace:
#0 C:\xampp\htdocs\mydistro.com\includes\database\database.inc(2171): PDOStatement-&gt;execute(Array)
#1 C:\xampp\htdocs\mydistro.com\includes\database\database.inc(683): DatabaseStatementBase-&gt;execute(Array, Array)
#2 C:\xampp\htdocs\mydistro.com\includes\database\mysql\query.inc(36): DatabaseConnection-&gt;query('INSERT INTO {bl...', Array, Array)


saying that the block table is missing. All other tables belonging to the modules that are listed as dependencies in standard.info are also missing:

dependencies[] = block
dependencies[] = color
dependencies[] = comment
dependencies[] = contextual
dependencies[] = dashboard
.
.
.


I have tested with Drupal 7.38 on Windows 7, php 5.6.2.

Same test and same result also with minimal profile.

Any idea about what I am doing wrong?
Are you adding those dependencies to your .info file mydistro.info?

If not, you should. It looks like the install is getting to line 196 in the standard.install file and then trying to enable all those blocks, but the blocks module was never enabled and it doesn't test for that, which is breaking the install. @VanD

Basically you should add the same modules listed as dependencies in the standard profile, also to mydistro.info and re-run the installation.